0
votes

In AS3 (Flash), I want an external swf-file to load when I click a specific menu button. I also want the swf to disappear when I click another button, so that another swf can load. This code shows my swf, but it just "loops". And also it covers my menu (on the top of the page) so I can't click anywhere. What could I change in the code to fix this?

var loader_mc : Loader = new  Loader();
   addChild(loader_mc);

bilder_btn.addEventListener(MouseEvent.CLICK,  buttonClick)
function  buttonClick(e:MouseEvent):void
{
     try{
loader_mc.unloadAndStop();
} catch(e:Error) {
}
      var urlRequest : URLRequest = new  URLRequest("flickr.swf");
      loader_mc.load(urlRequest);
}
1
what do you mean by" it just loops" ? if the loaded swf is loping you will need a stop(); in thereM4tchB0X3r
I've tried with stop(); and nothing happens. Where should I put it?user1390252
in your child swf, wherever you need it to stop!M4tchB0X3r

1 Answers

0
votes
  1. Change loader_mc's X and Y so that the loaded SWF does not cover your menu.
  2. You could do better with reinitializing that loader_mc to load another SWF, that is, create a new Loader(), removeChild() the old loader, addChild() the new one, then load.