Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    actionscript help

    Hi, I've been racking my brain over this for too long and give up, any help would be appreciated, thanks.

    all I want to do is have a menu hidden on the stage and when the mouse enters the x and y co-ordinates of the box that I have specified, the movieclip that contains the menu with it's buttons reveals itself by playing. So far I have the following code:

    Code:
    collectionmenubg.onEnterFrame = function() {
    
    	if (_xmouse<27 && _ymouse<17) {
    		collectionmenubg.gotoAndPlay(2);}
    	
    }
    It's working, but the x and y co-ordinates don't seem to be reacting the way I want them too. I have the movie clip that contains the menu sitting at X=27 and Y=17, so logic would dicate that my script should be someting like:

    Code:
    if (_xmouse>27 && _ymouse>17)
    but logic is not working, i can only get it to kinda work when I switch it around similar to the first example. and then I have to try and figure how to tell flash to put the movieclip back to frame 1 if I go past the width and height of the box's co-ordinates...

    does this make any sense? i hope so, i could really use some help...

    thanks

  • #2
    New Coder
    Join Date
    May 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Depending on what you actually want to do with your flash file you could do something far simpler.

    Code:
    collectionmenubg.onRollOver = function () {
        this.gotoAndPlay(2);
    }
    
    collectionmenubg.onRollOut = function () {
        this.gotoAndStop(1);
    }
    HTH
    Flexible UK web hosting solutions for designers and developers
    PHP5, Ruby on Rails, MySQL, spam and virus filtering
    UK Hosting from Media72, Media72 on twitter

  • #3
    New Coder
    Join Date
    Feb 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    jamie, thanks for your help. I am going to go try that, however I have a feeling that using a rollover statement like that will cause it to act like a button, or force me to use a button, which i don't want to do, since the movie clip will contain a menu in it.

    so it will be confusing for users to have the pointer switch to the link pointer when they rollover the clip.

    anyway, here's hoping this is not the case.

    regards...

    batch

  • #4
    New Coder
    Join Date
    Feb 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes, as i suspected using the rollover to activate a movie clip that contains a movie clip with menu buttons in it sends flash into a tizzy, causing the pointer to maniacally switch from the arrow to the finger pointer.

    so i am back to trying to get a handle on using the x and y thing as mentioned above.

    anyone good at this sort of thing?

    thanks

  • #5
    New Coder
    Join Date
    May 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can tell flash not to use the hand cursor, look up the command in the help. Using the rollOver only usually works in very simple situations with few interactions.

    Another method would be to use hitTest.

    Code:
    collectionmenubg.onEnterFrame = function() {
    	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
    		this.gotoAndPlay(2);
    	}
    }
    Take a look at this website for a good discussion of different button interaction methods http://www.senocular.com/flash/tutor...ttoncapturing/ also their code library http://senocular.com/flash/actionscr...ttonEvent.html

    Jamie
    Flexible UK web hosting solutions for designers and developers
    PHP5, Ruby on Rails, MySQL, spam and virus filtering
    UK Hosting from Media72, Media72 on twitter

  • #6
    New Coder
    Join Date
    Aug 2005
    Location
    Edmonton, Canada
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey Jamie, those links that you provided by Senocular were awesome! You learn something new every day =)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •