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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic text variable 1

Status
Not open for further replies.

Adam14

Technical User
Nov 8, 2003
193
CA
If I have a dynamic textbox variable in a movieclip, can I call it from the main movie? And if so, how?

Thanks,
Adam
 
Call it?

Regards,

cubalibre2.gif
 
Sorry, I mean, if I put a dynamic text box in my main movie, with the same variable name as a box in my movie clip, it doesn't show up.
 
You mean two different textfields with the same variable name? Why?

Regards,

cubalibre2.gif
 
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"?


Thanks,
Adam
 
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.




Regards,

cubalibre2.gif
 
Thanks again. You're a big help to me.

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top