Search code examples
actionscript-3flashloader

ActionScript 3.0 can't load SWF file


I have a problem about loading a SWF file(the SWF with a Main.as)

Here is my code:

bt1.addEventListener(MouseEvent.CLICK, f1);

var myloader:Loader = new Loader();
var myURL:URLRequest = new URLRequest("test.swf");

myloader.load(myURL); 

function f1(Event:MouseEvent):void
{
   addChild(myloader);

   myloader.x=100;
   myloader.y=200;
   myloader.width =200;
   myloader.height =60;    
} 

When I clicked load button, I can hear the sounds(test.swf), but I cant see anything.


Solution

  • Did you try with stage.addChild(myloader);?