Copy link to clipboard
Copied
Hi everyone,
Here I have a symbol(symbol1), it contains 3 layers
removeChild(this)
It goes all well. Until I changed layer2 and layer 3 into symbol2 and symbol3.
After layer2, layer3 are changed into symbols.
Symbol2 is put back on layer2, and Symbol3 is on layer3.
Everything keeps same, just all key frames are now contained in individual symbols.
And then, code on layer1 raises error. IT DOES NOT WORK NOW.
Error #1034: Type Coercion failed: flash.display::Stage@5e12d25d0d1 cannot convert to flash.display.MovieClip
I've also tried
removeChild(this.symbol2)
to remove one layer directly. It still fails
ArgumentError: Error #2025: The provided DisplayObject must be a child of the caller.
Trace(symbol2.parent)
The result of the Trace statement above is: Parent of symbol2: [object symbol1]
So symbol2, is indeed a child of symbol1.
Any ideas? Again it works again if I put all key frames back on layer 2 and 3. But I just want to make them individual symbols so it'd be easier to reuse.
Thanks.
Copy link to clipboard
Copied
you should be using instance names.
whatever you want to remove use, trace(this) or trace(this.name), to confirm you have dealing with the correct object. then you can use:
whatever.parent.removeChild(whatever)