-
How to create a Dynamic text field inside a movieclip?
Ok so I have a few dynamic text fields that I created inside my movie clip. The text fields have vars attached to them, so for example I have:
var exp= 0;
and one dynamic text field inside my movieclip would have the var name 'exp'.
The problem I'm having is that I declared all my variables on my main timeline, but have placed my dynamic text fields inside the movieclip, so when I test my movie 0 doesn't pop up in the dynamic text field.....
but if I declare my variables inside the movieclip my var will appear...
does anyone know how to fix this problem?
-
Senior Member
You can try using _root.exp for the text field variable, or set the text field in the main timeline.
For AS2 its "_root", for AS3 its "MovieClip(root)".
The alternative and better method would be to use the following code in a frame on the main timeline:
Code:
var exp = 0;
myMovieClip.myField.text = exp; // change instance names to whatever you have
-
i tried your codes, but my vars still didnt appear....
when you said instance name, what did you mean by that?
-
/:exp This should be in your text variable name if it is inside of a MovieClip and you declared its value one level up.
poltuda
-
Senior Member
Instance names are how you refer to objects via code. In the properties window, there is a field where you can enter an instance name for almost any object from MovieClip to TextField. So in the example above, "myMovieClip" is the instance name of a MovieClip and "myField" is the instance name of a TextField.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|