In clip_mc I have timeline animation. When it finished I should change countN++ on main timeline. I tested as you suggested. I created ClipClass.as (just added import flash.display.MovieClip; )
on main timeline I have code var clip_mc:MovieClip=new ClipClass(); // linkage with name ClipClass in library addChild(clip_mc); Now that does not work 1017: The definition of base class MovieClip was not found. 5000: The class 'ClipClass' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. I 2010/4/15 Kerry Thompson <[email protected]>: > natalia Vikhtinskaya wrote: > >> 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? > > I would pass in a reference to the timeline to the clip_mc. > > You will need to have a class with a constructor for the clip_mc. For > example, set the linkage of clip_mc to ClipClass, and create this AS > file: > > package > { > public class ClipClass extends MovieClip > { > private var myRoot:MovieClip; > private var parentCount:Number; > > public function ClipClass (pMyRoot:MovieClip) > { > myRoot = pMyRoot; > } > > private function getCount():Number > { > parentCount = myRoot.countN; > } > } > } > > There are undoubtedly errors in this--it's just e-mail ActionScript, > but it should be enough to get you going. > > I would recommend very strongly against timeline programming in > ActionScript 3, though. It's designed for OOP, and you'll find your > code much more manageable if you use OOP practices. Instead of putting > code on the timeline, put it in a class, and make that your document > class. > > Cordially, > > Kerry Thompson > > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

