0

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);
}
3
  • what do you mean by" it just loops" ? if the loaded swf is loping you will need a stop(); in there Commented Mar 28, 2013 at 11:26
  • I've tried with stop(); and nothing happens. Where should I put it? Commented Mar 28, 2013 at 11:35
  • in your child swf, wherever you need it to stop! Commented Mar 28, 2013 at 11:40

1 Answer 1

0
  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.
Sign up to request clarification or add additional context in comments.

1 Comment

loader)mc.y=60; and removeChild(loader_mc); loader_mc.content.unloadAndStop(); loader_mc=new Loader(); addChild(loader_mc);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.