我刚刚实现了您发送的最后一段代码 - 非常感谢!! 这是此框架的完整上下文,完整的代码与其他按钮一起,以防引起问题。我用这段代码得到的19个错误是:
1120:访问未定义的属性fl_ProLoader_01
stop();
//home button
mythbutt_home.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_01_1,false,0,true);
function fl_ClickToLoadUnloadSWF_01_1(event:MouseEvent):void
{
removeChild(fl_ProLoader_01);
fl_ProLoader_01.unloadAndStop();
fl_ProLoader_01 = null;
}
mythbutt_home.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_01_1,false,0,true);
function fl_ClickToGoToAndStopAtFrame_01_1(event:MouseEvent):void
{
removeChild(fl_ProLoader_01);
}
mythbutt_home.addEventListener(MouseEvent.CLICK, fl_ClickToStopAllSounds_01_1,false,0,true);
function fl_ClickToStopAllSounds_01_1(event:MouseEvent):void
{
SoundMixer.stopAll();
}
mythbutt_home.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_01_2,false,0,true);
function fl_ClickToGoToAndStopAtFrame_01_2(event:MouseEvent):void
{
gotoAndStop(1);
}
//other buttons at the bottom
mythbutt_aboriginal_culture.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_01_1);
function fl_ClickToGoToWebPage_01_1(event:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.bigmyth.com/fullversion/password033/download/ABORIGINAL_CULTURE.pdf"), "_blank");
}
mythbutt_aboriginal_pantheon.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_01_2);
function fl_ClickToGoToWebPage_01_2(event:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.bigmyth.com/fullversion/password033/download/ABORIGINAL_PANTHEON.pdf"), "_blank");
}
mythbutt_aboriginal_exercises.addEventListener( MouseEvent.CLICK, fl_ClickToGoToWebPage_01_3);
function fl_ClickToGoToWebPage_01_3(event:MouseEvent):void
{
navigateToURL(new URLRequest( "http://www.bigmyth.com/fullversion/password033/download/ABORIGINAL_EXERCISES.pdf"), "_blank");
}
//start button
//Change your event handler function.
start_button_aboriginal.addEventListener(MouseEvent.CLICK,fl_ClickToLoadSWF_01_2);
function fl_ClickToLoadSWF_01_2(event:MouseEvent):void {
fl_ProLoader_01=new ProLoader ;
fl_ProLoader_01.load(new URLRequest("myths/myth_aboriginal.swf"));
fl_ProLoader_01.contentLoaderInfo.addEventListener(Event.COMPLETE,
//Using closure callback instead of *onComplete_1* function
function( e : Event ) {
e.currentTarget.content.addEventListener( Event.ENTER_FRAME, OEF_01);
});
addChild(fl_ProLoader_01);
fl_ProLoader_01.x=323;
fl_ProLoader_01.y=41;
//Swap the event handlers,no need for flag,clear code blocks
start_button_aboriginal.removeEventListener(MouseEvent.CLICK,fl_ClickToLoadSWF_01_2);
start_button_aboriginal.addEventListener(MouseEvent.CLICK,fl_ClickToUnLoadSWF_01_2);
}
function fl_ClickToUnLoadSWF_01_2(event:MouseEvent):void {
fl_ProLoader_01.removeEventListener(Event.ENTER_FRAME,OEF_01);
removeChild(fl_ProLoader_01);
fl_ProLoader_01.unloadAndStop();
fl_ProLoader_01=null;
start_button_aboriginal.removeEventListener(MouseEvent.CLICK,fl_ClickToUnLoadSWF_01_2);
}
function OEF_01(e:Event):void {
if (e.currentTarget.currentFrame==e.currentTarget.totalFrames) {
e.currentTarget.stop();
fl_ClickToUnLoadSWF_01_2(null);
}
}
答案 0 :(得分:2)
我认为@GarryWong是对的。如果在加载外部swf 之后单击 start 按钮,并且在时间线完成之前,您将收到错误消息。
我已经改变了你的实现,请试试这个。 无需检查空对象。
//Change your event handler function.
startbutton.addEventListener(MouseEvent.CLICK,fl_ClickToLoadSWF_1_2);
function fl_ClickToLoadSWF_1_2(event:MouseEvent):void {
fl_ProLoader_1=new ProLoader();
fl_ProLoader_1.load(new URLRequest("myths/myth_aboriginal.swf"));
fl_ProLoader_1.contentLoaderInfo.addEventListener(Event.COMPLETE,
//Using closure callback instead of *onComplete_1* function
function( e : Event ) {
e.currentTarget.content.addEventListener(Event.ENTER_FRAME, OEF_1);
});
addChild(fl_ProLoader_1);
fl_ProLoader_1.x=207;
fl_ProLoader_1.y=41;
//Swap the event handlers,no need for flag,clear code blocks
startbutton.removeEventListener(MouseEvent.CLICK,fl_ClickToLoadSWF_1_2);
startbutton.addEventListener(MouseEvent.CLICK,fl_ClickToUnLoadSWF_1_2);
}
function fl_ClickToUnLoadSWF_1_2(event:MouseEvent):void {
fl_ProLoader_1.removeEventListener(Event.ENTER_FRAME,OEF_1);
removeChild(fl_ProLoader_1);
fl_ProLoader_1.unloadAndStop();
fl_ProLoader_1=null;
startbutton.removeEventListener(MouseEvent.CLICK,fl_ClickToUnLoadSWF_1_2);
//Use the below line only if you want to repeat the procedure of loading the *Proloader*, otherwise omit it.
startbutton.addEventListener(MouseEvent.CLICK,fl_ClickToLoadSWF_1_2);
}
function OEF_1(e:Event):void {
if (e.currentTarget.currentFrame==e.currentTarget.totalFrames) {
e.currentTarget.stop();
fl_ClickToUnLoadSWF_1_2(null);
}
}
抱歉,我现在没有在我的电脑上安装Flash,所以也许我的代码会出现一些错误。 你让我启动了我的Windows分区! < / p>