Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2006
    Location
    São Paulo, Brazil
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access main timeline variables from movie clip

    Hello, folks!

    I have a doubt that is making me mad.

    Suppose that I have a variable defined in the main timeline, like this:

    Code:
    var str:String = "foo";
    Suppose too that I have a movie clip called mc1 inside the same keyframe of the variable instanced before ( I think this is not important for the test ).

    Here is the doubt: How do I access the variable str from movie clip mc1??

    I tried this, without success:

    Code:
    trace( stage.getChildByName("root1").str );
    trace( stage.root.str );
    trace( stage.getChildByName("root1").getChildByName("str") );

    Why it does'nt work??

    Thanks for any help!!!
    ----
    As coisas mais simples são as mais importantes.
    ---------
    Thompson M1A1: D-Day
    ----------------

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    There should be a "target" image in the actionscript panel that will allow you to traverse the timeline looking for any variables you wish to use.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i saw your post so i register this forum, it's work method i did,

    /*in maintimeline*/

    function testvar():Array{

    var test_ary:Array = new Array();

    test_ary[0] = "http://something.com";
    test_ary[1] = "foo";

    return test_ary;
    }

    /* in as file */
    package {
    ...
    var ary_var:Array = testvar();
    trace(ary_var[0]);
    trace(ary_var[1]);
    ...
    }

    sorry my english, i from hong kong


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •