In an mc I've created a random variable to mawk rolling dice. The output is saved as variable name "Attack" in the textbox within the mc. In the main movie, I want the variable "Attack" to be able to be used and manipulated. I posted the link to the .fla if you need clarification. Is there an easier way?...I'm trying to create little games and such, in order to learn the actionscript. Also, with the variable:
dice = random(7)
is there a way to make sure it doesn't end on "0"?
Didn't look at your .fla (might though!), but now think I understand what you're wanting...
Just reference your variable to the main timeline by adding _level0 to your "Attack" variable. Thus your textfield's variable's name will be _level0.Attack rather than just Attack alone. You can set or read it from anywhere as such.
On the main timeline just...
trace(_level0.Attack);
Or set a value to it...
_level0.Attack = value;
As for random (that's Flash 5 right?), use...
dice = random(6)+1;
If random = 0, then it will equal 1, and if it equals 6 then it will be 7.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.