So you check for null before executing the script: addEventListener( Event.ENTER_FRAME, onEnterFrameHandler, false, 0, true ); var mc:MovieClip; function onEnterFrameHandler( event:Event ):void{ mc=_items.getChildByName("item2"); if( mc ){ removeEventListener( Event.ENTER_FRAME, onEnterFrameHandler ); //do your code here } }
-- Warm Regards Deepanjan Das W: http://deepanjandas.wordpress.com || Om Manasamarthadata Shri Aniruddhaya Namah || *"Think of the environment before printing this email"* On Thu, Jan 13, 2011 at 10:05 PM, natalia Vikhtinskaya < natavi.m...@gmail.com> wrote: > Yes I understand. What possible to do? > > 2011/1/13 Deepanjan Das <deepanjan....@gmail.com>: > > Thats why you are getting a null value as the time when the script is > > executing, the frame 2 of _item is not available. > > > > For this you need to execute the script once you are sure the fame 2 of > > _item has loaded. > > > > Warm Regards > > Deepanjan Das > > > > On Thu, Jan 13, 2011 at 9:24 PM, natalia Vikhtinskaya > > <natavi.m...@gmail.com> wrote: > >> > >> it placed in frame # 2. > >> > >> 2011/1/13 Deepanjan Das <deepanjan....@gmail.com>: > >> > I mean item2 placed in first frame of _item? > >> > DD > >> > > >> > On Thu, Jan 13, 2011 at 9:18 PM, Deepanjan Das < > deepanjan....@gmail.com> > >> > wrote: > >> >> > >> >> Hi, > >> >> Is the item2 placed on first frame in item1? > >> >> > >> >> Warm Regards > >> >> Deepanjan Das > >> >> W: http://deepanjandas.wordpress.com > >> >> > >> >> On Thu, Jan 13, 2011 at 9:15 PM, natalia Vikhtinskaya > >> >> <natavi.m...@gmail.com> wrote: > >> >>> > >> >>> It is still null > >> >>> > >> >>> 2011/1/13 Deepanjan Das <deepanjan....@gmail.com>: > >> >>> > You may try using getChildByName("instance name"); also. > >> >>> > > >> >>> > var mc:MovieClip=_items.getChildByName("item2"); > >> >>> > > >> >>> > > >> >>> > -- > >> >>> > Warm Regards > >> >>> > Deepanjan Das > >> >>> > W: http://deepanjandas.wordpress.com > >> >>> > || Om Manasamarthadata Shri Aniruddhaya Namah || > >> >>> > "Think of the environment before printing this email" > >> >>> > > >> >>> > > >> >>> > > >> >>> > On Thu, Jan 13, 2011 at 9:00 PM, natalia Vikhtinskaya > >> >>> > <natavi.m...@gmail.com> wrote: > >> >>> >> > >> >>> >> I need to convert game from AS2 to AS3. This game has movie clip > >> >>> >> “_items” on the stage with frames. Each frame has different mc. > >> >>> >> frame 1- has mc “item1” > >> >>> >> frame 2- has mc |”item2” … > >> >>> >> > >> >>> >> _items.gotoAndStop(2) > >> >>> >> trace(_items.item2) // for AS2 it gives mc > >> >>> >> In AS3 it gives none > >> >>> >> (it works correctly only _items.gotoAndStop(1); > >> >>> >> trace(_items.item1)) > >> >>> >> > >> >>> >> > >> >>> >> I need to have variable with reference > >> >>> >> var mc:MovieClip=_items.item2 > >> >>> >> > >> >>> >> How to solve this situation in AS3? > >> >>> >> > >> >>> >> Thank you in advance. > >> >>> >> > >> >>> >> _______________________________________________ > >> >>> >> Flashcoders mailing list > >> >>> >> Flashcoders@chattyfig.figleaf.com > >> >>> >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >> > >> >> > >> >> > >> >> -- > >> >> Warm Regards > >> >> Deepanjan Das > >> >> W: http://deepanjandas.wordpress.com > >> >> || Om Manasamarthadata Shri Aniruddhaya Namah || > >> >> "Think of the environment before printing this email" > >> > > >> > > >> > > >> > -- > >> > Warm Regards > >> > Deepanjan Das > >> > W: http://deepanjandas.wordpress.com > >> > || Om Manasamarthadata Shri Aniruddhaya Namah || > >> > "Think of the environment before printing this email" > >> > > > > > > > > > -- > > Warm Regards > > Deepanjan Das > > W: http://deepanjandas.wordpress.com > > || Om Manasamarthadata Shri Aniruddhaya Namah || > > "Think of the environment before printing this email" > > > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders