Try
this.removeChild(myChild);
parent.removeChild(myChild);
Without the myChild reference in the beginning.
Or set the child in the beginning.
ParentMCName.addChild(myChild);
Then you should be able to reference the parent if was defined when
creating the child.
Hth.
Karl
Sent from losPhone
On Nov 22, 2009, at 6:06 PM, ktt <[email protected]> wrote:
strangely
trace (myChild.parent)
outputs
[object someObject]
but it doesn't work when I try to
remove via
myChild.parent.removeChild(myChild)
or via reference..
the child before was added simply by
addChild(myChild)
Ktt
--- On Sun, 11/22/09, Chris <[email protected]> wrote:
From: Chris <[email protected]>
Subject: Re: [Flashcoders] Detect child parent
To: "Flash Coders List" <[email protected]>
Date: Sunday, November 22, 2009, 10:27 PM
It sounds like what you are doing is
correct. Perhaps your child isn't on
the stage.
Try something like this:
if(child.parent){
child.parent.removeChild(child);
}
Which will only attemp to remove child if the parent
exists.
If you expect your child to always be parented, you might
want to yell
loudly about it:
if(child.parent){
child.parent.removeChild(child);
}else{
throw new Error("This child doesn't
currently have a parent.");
}
On Sun, Nov 22, 2009 at 1:15 PM, Ktu
<[email protected]>wrote:
Are you sure that the child you are trying to remove
is in a display list?
Ktu
On Sun, Nov 22, 2009 at 3:08 AM, Karl DeSaulniers
<[email protected]
wrote:
Maybe..
var childParent:Object = mychild.parent;
childParent.removeChild(mychild)
or
var childParent:Object = mychild._parent;
childParent.removeChild(mychild)
Karl
On Nov 22, 2009, at 1:58 AM, Karl DeSaulniers
wrote:
mychild.parent.removeChild(mychild)
Karl DeSaulniers
Design Drumm
http://designdrumm.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders