|
-
Easy? Setting main timeline variable from MC
I am trying to set a variable on the main timeline via a MC.
On the first frame of the main timeline I have:
Code:
stop();
leafName="SILENT RUNNING";
Then I have a MC, leafGenerator, and in the first frame I have a stop (then a new frame is chosen randomly). On the second frame I have:
Code:
leafName="AUSSIE PINE";
Finally, I have another MC, placard, with a text box inside, idText1. On the MC, I have the code:
Code:
onClipEvent(load){
this.idText1="BLUE MAPLE CREEK"
this.idText1=_root.leafName;
}
I can get the text box to display BLUE MAPLE CREEK, and SILENT RUNNING, but I can't get it to say AUSSIE PINE. How can I do this?
Any help is much appreciated; thanks in advance.
-
Senior Member
code: _root.leafName = "Aussie Pine.";
_t
-
Unfortunately, I've tried that, and it doesn't work.
-
Senior Member
What do you want to do?
You are storing the Aussie Pine value within the MC leafGenerator. This is not the same as leafName on _root. Therefore, if you want the leaf generator to update the variable on _root, you need to use
Code:
_root.leafName = "Aussie Pine.";
Otherwise, if you want to keep the leafName variable in leafGenerator seperate, and just display it's value in your placard MC, you need to use the correct path to it, something like:
Code:
_root.leafGenerator.leafName;
Hope this helps.
-
I figured it out. I used what both of you suggested (putting the "_root." in there) as well as changed onClipEvent(load) to onClipEvent(enterFrame) which continuously searches out what the variable is, even if it changes.
Thanks!
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
|