A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Easy? Setting main timeline variable from MC

  1. #1
    Member
    Join Date
    Apr 2004
    Location
    IA, USA
    Posts
    57

    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.

  2. #2
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386
    code:
    _root.leafName = "Aussie Pine.";



    _t
    I don't feel tardy.

  3. #3
    Member
    Join Date
    Apr 2004
    Location
    IA, USA
    Posts
    57
    Unfortunately, I've tried that, and it doesn't work.

  4. #4
    Senior Member Cass101's Avatar
    Join Date
    Dec 2004
    Posts
    131
    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.

  5. #5
    Member
    Join Date
    Apr 2004
    Location
    IA, USA
    Posts
    57
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center