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

Passing a Variable to Movie Clip

Status
Not open for further replies.

lee20

IS-IT--Management
Jan 30, 2004
17
0
0
US
I have created a dynamic text box with a instance value of "short_slogan" and in the var field I also put short_slogan. When I convert the dynamic text box to a symbol and call it "short_slogan" it puts the dynamic text into a movie clip. When I edit the movie clip, on the first static frame if I put:
short_slogan = "hello world";
it works fine. But when I go back to Scene1 and give short_slogan a value it says prints something like "_level0.instance88.short_slogan". I plan to pass the variable into the swf from a php page. But I can't even pass it from outside of the movie clip. Does anyone know what I can do to fix this??
thanks,
lee20
 
Hi Lee,
you have to scope your variables so that they are available in whatever movieclip or function that you need them. Search for "scoping" in your flash help files for more details. A quick work around is to make the variable global by creating it as
_global.short_slogan="hello";

and then putting _global.short_slogan in the var part of your text box. It's a good idea to read up on this however because there are good practice issues with using global variables. You could also set the text in your scene 1 using dot notation. For example movieclipinstance.short_slogan="hello"; or even movieclipinstance.short_slogan.text="hello";

Also it'd be best to call yr text box something different from the variable if only to make it clearer to yourself.
hope that helps,
cheers
Sarah
 
Okay,thanks alot. I'll have to do some reading but atleast now I know what I'm searching for. Thanks!
lee20
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top