...

View Full Version : actionscript help



batch
06-20-2006, 11:19 PM
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:



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:


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

JamieD
07-05-2006, 08:04 AM
Depending on what you actually want to do with your flash file you could do something far simpler.


collectionmenubg.onRollOver = function () {
this.gotoAndPlay(2);
}

collectionmenubg.onRollOut = function () {
this.gotoAndStop(1);
}

HTH

batch
07-05-2006, 06:50 PM
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

batch
07-05-2006, 07:51 PM
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

JamieD
07-05-2006, 08:01 PM
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.


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/tutorials/buttoncapturing/ also their code library http://senocular.com/flash/actionscript.php?file=ActionScript_2.0/com/senocular/events/ButtonEvent.html

Jamie

ealbrecht
07-05-2006, 11:49 PM
Hey Jamie, those links that you provided by Senocular were awesome! You learn something new every day =)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum