Search code examples
actionscript-3movieclip

How to make a symbol remove itself at a certain frame?


I'm struggling on doing a simple thing, I have an object that generates a smoke trail by creating and adding a simple animation done in flash. All works fine but I can't seem to find an easy way to make the smoke remove itself after playing the animation, if i add something like this.parent.removeChild(this); to the last frame of the animation the app simply crashes with Cannot access a property or method of a null object reference.

what am i doing wrong?


Solution

  • the animation keeps playing even thought the object is no longer being rendered, at the second call of this.parent.removeChild(this); the object was no longer parented to any object, stopping the animation solved the problem

    thank you frankhermes

    this.parent.removeChild(this);
    this.stop();