Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

External SWF does not play - stays on first frame

New Here ,
Sep 23, 2014 Sep 23, 2014

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);

}

TOPICS
ActionScript
194
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 23, 2014 Sep 23, 2014
LATEST

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);

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines