View Full Version : Access main timeline variables from movie clip

03-25-2008, 02:54 PM
Hello, folks!

I have a doubt that is making me mad.

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

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:

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

Why it does'nt work??

Thanks for any help!!!

03-25-2008, 05:13 PM
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.

02-03-2010, 06:25 PM
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();

sorry my english, i from hong kong :)