Skip to main content
Participant
September 23, 2014
Question

External SWF does not play - stays on first frame

  • September 23, 2014
  • 1 reply
  • 201 views

My external SWF file plays fine until I add the remove on mouse event (SWF file loops until a button is clicked). When removeSwf is add the SWF stays on the first frame.

Any help would be wonderful - Thank you

var request:URLRequest = new URLRequest("PicLoop3working.swf");

var loader:Loader = new Loader()

loader.load(request);

addChild(loader);

addEventListener(MouseEvent.CLICK, removeSWF);

function removeSWF(e:MouseEvent):void{

removeChild(loader);

}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 23, 2014

if you click twice that will generate an error and stop your app from doing anything else.  of course, you may have other errors too, but to fix that one use:

var request:URLRequest = new URLRequest("PicLoop3working.swf");

var loader:Loader = new Loader()

loader.load(request);

addChild(loader);

addEventListener(MouseEvent.CLICK, removeSWF);

function removeSWF(e:MouseEvent):void{

if(loader.stage){

removeChild(loader);

}

}