-
Calling a variable from inside a movieclip AS3 in Flash CS4
I am trying to trace a variable string from inside a movieclip which is inside another movieclip on the main timeline using:
trace(VariableString);
and also
trace(stage.VariableString);
Neither work
The variable is an input textfield and traces fine when it is on the main timeline but will not work from inside the movieclip. I am using Actionscript 3 in Flash CS4.
I appreciate this has probably been discussed previously on this forum but I cannot find a difinitve answer that seems to work.
Thanks
-
Prid - Outing
Actionscript Code:
trace(MovieClip(root).VariableString);
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Thanks for the quick reply, however this just gives an error 1180: Call to a possibly undefined method MovieClip. trace(MovieClip(root).VariableString);
When I trace this on the main timeline this works: trace(VariableString);
Does it make any difference if inside the MovieClip, I am using the Textinput component?
If so why would it make a difference once I am inside a MovieClip.
I am very very confused with this. Thanks again for the help.
-
Prid - Outing
Don't tell me you put the code INSIDE the Textinput component movieclip? That won't work, you'll have to put it in a normal movieclip!
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
I think I had better explain a little better.
On Keyfrme1 I have a MovieClip1 containing a text input component. I have created a variable on keyframe 1 using:
var VariableString1:String = new String();
When clicking on a separate button this happens:
VariableString1 = MovieClip1.text;
I can trace this correctly on the main timeline using:
trace(VariableString1);
However, if I try to trace this from another keyframe inside a movieclip2 which is inside another movieclip3 using:
trace(MovieClip1(root).VariableString1);
I just get the error 1180 call to a possibly undefined method MovieClip1
Sorry if this is not very clear but I am getting very confused with this.
Thanks again
-
Prid - Outing
oh, lol, MovieClip(root) should stay like that, you're not supposed to change MovieClip to the name of your clip :P
Just this:
Actionscript Code:
trace(MovieClip(root).VariableString1);
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Fantastic it works, thank you for all your help.
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
|