-
Senior Member
display a variable
hi
i want a text box to display a variable, and have it refresh every time the variable is changed or something to the same effect.
-
well, make a dynamic textbox. when you make a textbox, there should be a drop down menu with one of the choices being dynamic. then give it a variable name. if you have flash mx, you have the option of giving it a variable or instance name. if you go with variable name, then you can access it with _root.variablename. if you give it an instance, then _root.instance.text. then you just set the variable.
_root.variable=w/e or _root.instance.text=w/e
to refresh, you can have a loop in an onEnterFrame event.
_root.onEnterFrame=function(){
_root.variable=w/e
}
if you're using flash 5, then you need to make an Empty movie clip and put it on the stage and give it hte code:
onClipEvent(enterFrame){
_root.variable=w/e
}
thats it.
-
Senior Member
Whoa.
That made almost no sense to me. Can it be explained again.. at a slower pace? Ill be more specific. Okay i gave my dynamic text box an instance name called TB. I have a variable name called PLACE. I have my "condition (the if thing)" but the "action" part of it i am still confused with. I don't really understand what goes next.
-
Senior Member
I am using Flash MX 2004.
I have a dynamic text box with an instance name of TB.
I have a variable named PLACE.
How can i get the value of PLACE to appear in the text box?
-
Originally posted by Flea-x
I am using Flash MX 2004.
I have a dynamic text box with an instance name of TB.
I have a variable named PLACE.
How can i get the value of PLACE to appear in the text box?
in your actions layer in the frame where you want the value of PLACE displayed do this:
PLACE="this is my text I want displayed in my dynamic box";
You could even sandwich that between an "if" statement if you want to control how and when your message is displayed.
Does that help?
-
Senior Member
No, it doesn't help a lot, but you have my thanks anyway. =)
The variable PLACE is already defined.. I just don't really understand how to make it display in the text box.
EDIT: If it is impossible to directly relate them how can i have it so when PLACE=1, display text "1", when place=2, display text "2" etc.
I think there was another thread about this somewhere but I don't know.
-
What I do is make a text box (and make sure "dynamic" is checked), then give it an instance name such like *placedisplay* or something. Then, in your actions put:
code: placedisplay.text = place
Edit:: Oops, forgot there is a little box under properties for your text box. The box says "Var". There you can put whatever your variable is, too (in this case, "place"). either way works.
Last edited by HungryJunction; 01-29-2004 at 10:38 PM.
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
|