Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

centralized actionscript

Status
Not open for further replies.

aamaker

Programmer
Jan 20, 2002
222
US
Ok, I know how to use flash to build simple buttons (mostly rely on script assist)... and thats fine, but I know its possible to centralize all the actionscript assignements for a series of buttons, so that early on in my movie, I click on a frame, add the actionscript that says _root.myMC.button_1.onRollover = function.....

and so on...

I have setup a simple movie to try to learn how to do this but its not working at all -- Im just calling TRACE("some text") and trying to get the button to trigger the trace message in the output window as a simple test.

I have the button inside a movie clip, that doent prevent this sort of thing from working, does it?

heres the A.S. I am using:

Code:
_root.navigation.button_1.onRollover= function(){ 
trace("Ok, I see you rolled over this button!")
}


What am I missing here?

 
Thing is, when assigning button handlers in this manner, there musn't be other other handlers defined on the movie clip holding these buttons, otherwise those first handlers will override any handlers on other symbols within that movie clip.

Furthermore, the button must be present on the same frame where you're defining the handler. In other words, if your button only appears on frame 5 of your movie clip, and your movie clip is stopped (as an example on frame 1...) when you assign the button's handler, it won't work. You would then need to only define the handler on frame 5 of that movie clip, when the button is present on stage...

Regards. Web Hosting - Web Design
03/13/05 -> OLDNEWBIE VS FLASHKIT
 
that helped a lot - specifically: "...the button must be present on the same frame where you're defining the handler."


Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top