tried that... no dice - just not seem to be able to find it.... ________________________________________ From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Geografiek [geograf...@geografiek.nl] Sent: Tuesday, February 23, 2010 10:10 AM To: Flash Coders List Subject: Re: [Flashcoders] Finding and Removing a Sprite
Hi Theodore, In your case try root.removeChild(mySprite); btw: the use of root is not recommended though. There was a discussion lately why. Maybe Jason is willing to illustrate in the case of this example? Willem On 23-feb-2010, at 15:31, Lehr, Theodore wrote: > I tried: > > removeChild(root.mySprite); > > and I get another error: > > 1119: Access of possibly undefined property mySprite through a > reference with static type flash.display:DisplayObject > > ________________________________________ > From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders- > boun...@chattyfig.figleaf.com] On Behalf Of Geografiek > [geograf...@geografiek.nl] > Sent: Tuesday, February 23, 2010 8:45 AM > To: Flash Coders List > Subject: Re: [Flashcoders] Finding and Removing a Sprite > > Hi Theodore, > When you say 'addChild(mySprite)' mySprite *is* the child of > something: the instance you call addChild on (addChild(mySprite) is > equal to this.addChild(mySprite)) > To remove mySprite you have to call removeChild(mySprite) on the same > instance. > From the error it seems that myChild is not a child of the instance > you call removeChild on. > > Did you trace mySprite.parent to see if mySprite is actually a child > of an instance? (traces null if mySprite is not a child of anything, > traces the parent if mySprite is added as a child) > parentName.removeChild(mySprite) does the trick then. > HTH > Willem van den Goorbergh > > On 23-feb-2010, at 14:23, Lehr, Theodore wrote: > >> I am trying to remove a Sprite via: >> >> removeSchild(mySprite); >> >> but I get the error: 1120: Access of undefined property mySprite); >> >> The Sprite is created ina function and is not neccessarily the >> child of anything - although it is created via addChild(mySprite) >> so I guess it is the child of something... >> >> How can I find it an remove it? >> >> Thanks! >> _______________________________________________ >> Flashcoders mailing list >> Flashcoders@chattyfig.figleaf.com >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= > Geografiek is a Dutch, Utrecht-based map and chart design company. > Willem van den Goorbergh can be contacted by telephone: (+31) > 30-2719512 or cell phone: (+31)6-26372378 > or by fax: (+31)302719687 > snail mail: Hooghiemstraplein 89 3514 AX UTRECHT > Visit our website at: http://www.geografiek.nl > =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= > > > > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders