mc.removeMovieClip()并不总是彻底销毁mc

今天读到EAS2.0
5.6.1 Deleting a Class’s Resources
Moock讨论了MovieClipLoader的特殊性以及彻底销毁ImageViewer实例的方法。
其中使用的removeMovieClip引起了我的思考,看下面代码:
//
var myClip_mc:MovieClip = createEmptyMovieClip("test_mc", this.getNextHighestDepth());
myClip_mc.removeMovieClip();
//
myClip_mc所引用的MovieClip被remove了,那myClip_mc的值是什么?
用一句
trace(myClip_mc);
Output一片空白!奇怪了,再用
trace(test_mc);
Output显示undefined。
如果在myClip_mc.removeMovieClip()之前调用trace(myClip_mc == test_mc);
输出是true,怎么remove过后就不一样了?
郁闷之中再调trace(typeof myClip_mc);
Output显示movieclip!
看来在这里removeMovieClip并没有彻底销毁myClip_mc!!!
如果你的代码中有if(myClip_mc == undefined) {…}
… 就不会运行,大家code的时候要注意这一点哦!

关于这个问题ASDG2中Chapter 18. ActionScript Language Reference
removeMovieClip( ) Global Function
中有详细的解释。

Advertisements
This entry was posted in Flash and ActionScript. Bookmark the permalink.

2 Responses to mc.removeMovieClip()并不总是彻底销毁mc

  1. Unknown says:

    wow gold!All wow gold US Server 24.99$/1000G on sell! Cheap wow gold,wow gold,wow gold,Buy Cheapest/Safe/Fast WoW US EU wow gold Power leveling wow gold from the time you wWorld of Warcraft gold ordered!

    wow power leveling wow power leveling power leveling wow power leveling wow powerleveling wow power levelingcheap wow power leveling wow power leveling buy wow power leveling wow power leveling buy power leveling wow power leveling cheap power leveling wow power leveling wow power leveling wow power leveling wow powerleveling wow power leveling power leveling wow power leveling wow powerleveling wow power leveling buy rolex cheap rolex wow gold wow gold wow gold wow gold -209868196577980

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s