Maybe I do something wrong?

On main timeline in the first frame
var countN:int=0;
var clip_mc = new clip_mc();
addChild(clip_mc);


in the firtst frame of clip_mc
addEventListener(Event.ADDED,added);

function added(e:Event) {
 var countN:int=MainTimeline(root).countN;
 //trace(countN)
}

that gives error
1180: Call to a possibly undefined method MainTimeline.



2010/4/15 Henrik Andersson <[email protected]>:
> natalia Vikhtinskaya wrote:
>>
>> Hi to all
>> On main timeline I have
>> var countN:int=0; // this numberl be changed later
>> var clip_mc = new clip_mc();  // this clip is placed in library
>> addChild(clip_mc);
>>
>> How  can I read countN inside clip_mc?
>>
>
> Wait for the clip to be ADDED. The use the parent or root property to get a
> reference to the main timeline. Do note that the type will be
> DisplayObjectContainer, not something with your custom stuff, so you will
> have to cast it to your correct type. Here, the MainTimeline.
>
> Variables defined in framescripts are converted to properties of the class
> for the timeline. In this case, properties of the document class.
>
> So do this:
>
> With the scope of clip_mc (say, the constructor or framescript in first
> frame):
> addEventListener(Event.ADDED,added);
>
> function added(e:Event) {
>  var countN:int=MainTimeline(root).countN;
> }
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to