Trying to load external .swf
import flash.media.Sound; import flash.events.KeyboardEvent; import flash.events.Event; import flash.ui.Keyboard; import flash.net.URLRequest; import flash.display.Loader; var sound:Sound = new songmp3(); sound.play(); var loader:Loader = new Loader(); var mcExternal:MovieClip; addChild(loader); loader.load(new URLRequest("Main.swf")); stage.addEventListener(KeyboardEvent.KEY_DOWN, playGame); function playGame(event:KeyboardEvent):void { if(event.keyCode == Keyboard.ENTER) { //gotoAndPlay(121); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,swfIn); } } function swfIn(event:Event):void { loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,swfIn); }
What exactly am I doing wrong? I want it so that when someone presses enter this .swf files unloads and the Main.swf loads and begins.