as3从孩子那里卸下来

时间:2013-09-17 13:52:45

标签: actionscript-3 flash

我正在尝试从孩子那里卸载ProLoader。

main.swf中的代码

import fl.display.ProLoader;
var myProLoader:ProLoader=new ProLoader();

page2_mc.addEventListener(MouseEvent.CLICK, page2content);
function page2content(e:MouseEvent):void {
var myURL:URLRequest=new URLRequest("page2.swf");
myProLoader.load(myURL);
addChild(myProLoader);
}


function unloadcontent(e:MouseEvent):void {
myProLoader.unload();
}

page2.swf中的代码:

return_mc.addEventListener(MouseEvent.CLICK,back);

function back(e:MouseEvent):void{
parent.parent['unloadcontent']();
}

当我运行这些时,我收到以下错误:

ArgumentError: Error #1063: Argument count mismatch on _09Start_working_fla::MainTimeline/unloadcontent(). Expected 1, got 0. at page2_fla::MainTimeline/back()

我只是希望child.swf中的mc卸载ProLoader的内容(返回main)。

感谢您的帮助。

此致 ReidarNygård

1 个答案:

答案 0 :(得分:1)

你的unloadcontent函数需要一个MouseEvent类型的参数。要在不必传入的情况下调用它,请将其更改为:

function unloadcontent(e:MouseEvent = null):void
相关问题