1
외부 swf를로드하려고합니다.외부 SWF로드시 오류 발생
하지만 컴파일 할 때 오류가 발생합니다.
ArgumentError: Error #1063: Argument count mismatch on Main/init(). Expected 0, got 1.
at flash.display::DisplayObjectContainer/addChild()
at flash.display::Stage/addChild()
at MainSWF/onLoadedAction()
에 SWFLoader 클래스
public function MainSWF():void
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
_loader = new Loader();
_my_url = new URLRequest("Main.swf");
_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressAction);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadedAction);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, IOErrorAction);
_loader.load(_my_url);
}
private function onLoadedAction(e:Event):void
{
var mc:Sprite = new Sprite();
mc.addChild(_loader.content);
trace(stage);
stage.addChild(mc);
_loader.removeEventListener(ProgressEvent.PROGRESS, onProgressAction);
}
이 오류는 하위 swf 또는 주 swf에서 발생합니까? –
동일한 ADDED_TO_STAGE 이벤트를 사용하는 경우 Main.swf 파일에서 init 함수가 e : Event를 얻지 못할 것으로 생각합니다. –