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

in flash actionscript 3 how to stop imported .swf when hit backbutton ? plz hurry to answer my deadline is coming

New Here ,
Aug 17, 2018 Aug 17, 2018

i use Flash cs 6 with action script 3

to import .swf i use this code but when i hit backbutton the video in sf file does not stop and still play on top of every thing

stop ();

var swfRequest:URLRequest = new URLRequest ("All clip 720p.swf");

var swfLoader:Loader = new Loader ();

    swfLoader.load (swfRequest);

  addChild (swfLoader);

190
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

correct answers 1 Correct answer

Community Expert , Aug 17, 2018 Aug 17, 2018

Hi.

For your button code, you can write something like this:

backButton.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void

{

    swfLoader.unloadAndStop(true);

    removeChild(swfLoader);

    swfLoader = null;

});

The Loader class has this unloadAndStop method that tries to unload the SWF and stop code execution from it.

It's also a good idea to remove the swfLoader object itself and set it to null to completely get rid of it and free up some memory.

I hope this helps.

Regards,

JC

Translate
Community Expert ,
Aug 17, 2018 Aug 17, 2018

Hi.

For your button code, you can write something like this:

backButton.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void

{

    swfLoader.unloadAndStop(true);

    removeChild(swfLoader);

    swfLoader = null;

});

The Loader class has this unloadAndStop method that tries to unload the SWF and stop code execution from it.

It's also a good idea to remove the swfLoader object itself and set it to null to completely get rid of it and free up some memory.

I hope this helps.

Regards,

JC

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
New Here ,
Aug 17, 2018 Aug 17, 2018

oh my god it work!!

you are my saviour man.

thank you thank you very much  ^____^

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 ,
Aug 17, 2018 Aug 17, 2018
LATEST

Excellent!

You're welcome!

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