Copy link to clipboard
Copied
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);
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
oh my god it work!!
you are my saviour man.
thank you thank you very much ^____^
Copy link to clipboard
Copied
Excellent!
You're welcome!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now