How to make a MovieClip remove itself in AS3?

后端 未结 5 1469
不思量自难忘°
不思量自难忘° 2021-01-18 13:41

What is the equivalent to removeMovieClip() in AS3?

Apparently many have the same question:
StackOverflow:

  1. How to completely remove a
5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-18 14:21

    this.parent.removeChild(this);
    

    This one should be working; it's what I use. One problem I had when I switched to AS3 is that sometimes it wouldn't be added as a child right, so you might want to check that. You also have to import flash.display via putting this at the top if you're not already:

    import flash.display.*
    

    You should also remove the event listener on it before removing it.

提交回复
热议问题