PDA

View Full Version : Teething troubles with variables


tinky
08-13-2001, 07:42 PM
Hello,

I am trying to pass a variable from a button in frame 1 to a button in frame 2 (both frames are in the same movie). Can someone help me in doing this? Also, how do I get frame 2 to display the value of this variable?

Any help will be greatly appreciated!!

Thanks,
Tinky

red penguin
08-13-2001, 09:28 PM
OK, tinky, if you initialize a var on the main timeline e.g. _root, it will always be there...no matter what frame your on...so

var snootch = "always";

will be the same...UNLESS you change it via button, code, etc...to dislay this, just create a textField, name it, say, displayText or something more meaningful, and on a button put this...

on(release){
_root.displayText = snootch;
trace(displayText); }

you're not passing a var from frame to frame, you are in effect, "passing" it to the textField to let the user see it.
the trace will, when testing, open the output so we, as the creator, can monitor things...
Make sense?

tinky
08-14-2001, 09:11 PM
Thanks, the code worked!!!!