使用 Flash for iOS 应用程序有点麻烦!我有一个按钮“开始”,它加载一个外部 swf。然后我有一个不同的按钮,“home”,它应该做三件事:
- 卸载外部 swf
- 停止所有声音
- 返回第一帧
这一切似乎都可以工作,但似乎 SWF 永远不会卸载!我一遍又一遍地听到它。
//code on frame follows...mythbutt_home
stop();
//home button
mythbutt_home.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_4);
function fl_ClickToGoToAndStopAtFrame_4(event:MouseEvent):void
{
removeChild(fl_ProLoader_3);
}
mythbutt_home.addEventListener(MouseEvent.CLICK, fl_ClickToStopAllSounds);
function fl_ClickToStopAllSounds(event:MouseEvent):void
{
SoundMixer.stopAll();
}
mythbutt_home.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_1);
function fl_ClickToGoToAndStopAtFrame_1(event:MouseEvent):void
{
gotoAndStop(1);
}
//start button
start_button_aboriginal.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3);
import fl.display.ProLoader;
var fl_ProLoader_3:ProLoader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad_3:Boolean = true;
function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void
{
if(fl_ToLoad_3)
{
fl_ProLoader_3 = new ProLoader();
fl_ProLoader_3.load(new URLRequest("myths/myth_aboriginal.swf"));
addChild(fl_ProLoader_3);
fl_ProLoader_3.x = 114;
fl_ProLoader_3.y = 41;
}
else
{
fl_ProLoader_3.unload();
removeChild(fl_ProLoader_3);
fl_ProLoader_3 = null;
}
// Toggle whether you want to load or unload the SWF
fl_ToLoad_3 = !fl_ToLoad_3;
}