我正在使用这个技术来重启游戏。代码如下:
function restart(e:MouseEvent) {
if (myLoader) {
removeChild(myLoader)
myLoader = null
}
myLoader = new Loader(); // create a new instance of the Loader class
var url:URLRequest = new URLRequest("aaa.swf"); // in this case both SWFs are in the same folder
myLoader.load(url); // load the SWF file
addChild(myLoader);
}我的问题是,每次重新启动游戏时,它变得越来越不平滑-动画,如果你知道我的意思。我认为,这是因为旧的SWF仍然在框架中,并减慢了新的SWF。有没有办法既能加载新的SWF,又能同时删除旧的SWF?我只是复制了这段代码,所以我不知道这段代码是不是在删除旧的SWF。提前感谢您:)
发布于 2011-12-11 15:18:26
请先试用myLoader.unload(),然后再删除...还可以使用FlashBuilder分析器查看旧实例是否仍在内存中。
https://stackoverflow.com/questions/8462503
复制相似问题