Reputation: 29
How do I close an SWF file using AS3? I want to include the close in an event listener, so when the user clicks a button the application will close. I tried:
fscommand("quit");
which doesn't work.
I simply want to unload an SWF running from an FLA file.
Upvotes: 1
Views: 3421
Reputation: 11
When I faced the same situation, I designed externally loaded swf smaller than root scene. Placed a close button at root scene to unload the swf. by setting visibility of close button, I managed it.
//loading command
fl_ProLoader = new ProLoader();
fl_ProLoader.load(new
URLRequest("OrgChart.swf"));
addChild(fl_ProLoader);
//unloading command
fl_ProLoader.unload();
removeChild(fl_ProLoader);
fl_ProLoader = null;
Upvotes: 1
Reputation: 35734
well that's not that easy. You can't unload the movie clip from within itself. This is only possible through Loader.unloadAndStop()
meaning you have to load the swf from another swf.
The other option is to create a JavaScript that you can call from the swf, to remove the swf file reference from the page.
Upvotes: 1