PDA

View Full Version : pass actionscript code through variable (dynamic buttons)



polishbroadcast
March 20th, 2005, 03:16 PM
i have some dynamic MC buttons which are working great but i want to basically inject what the onrelease code is for each button usng on onLoad command. Right now onLoad sends the button label and i would like to send the actionscript code as well.

On the MC that holds the button the onLoad passes this.label = "button label"; correctly. command = 'trace("osaka!");' passes that info to
on(release) {
command
} inside, but it treats it as text and not code. So how can i pass actionscript commands so they fill in the variables inside the button?


Thanks.

polishbroadcast
March 20th, 2005, 03:38 PM
Hi. I'm a total idiot.

Function!!! If i stick a fuction
function bttnCode () { yourCode; }; inside the onload fuction directly on the MC, and then i call
on(release) {
bttnCode();
}
inside the MC, then it works. Hopefully that will help someone else. Where is the slap head emoticon?

3rdeye
March 20th, 2005, 04:00 PM
:trout:

polishbroadcast
March 20th, 2005, 04:23 PM
awesome. :)