init();
function init():void
{
btnExitClip.addEventListener(MouseEvent.CLICK, btnExitClickHandler);
}
function btnExitClickHandler(event:MouseEvent):void
{
// Close Flash Movie with "Exit" button
// What comes here..?!
}
Closing Flash Movie with ActionScript 3.0How to?
Page 1 of 1
6 Replies - 40450 Views - Last Post: 01 January 2009 - 01:09 AM
#1
Closing Flash Movie with ActionScript 3.0
Posted 31 December 2008 - 11:06 PM
I am stuck trying to find out how I can close a Flash Movie using ActionScript 3.0. I don't know what should come in my MovieClip's mouse event handler.
Replies To: Closing Flash Movie with ActionScript 3.0
#2
Re: Closing Flash Movie with ActionScript 3.0
Posted 31 December 2008 - 11:16 PM
Is this for an AIR app? Or for swf?
#3
Re: Closing Flash Movie with ActionScript 3.0
Posted 31 December 2008 - 11:20 PM
swf
#4
Re: Closing Flash Movie with ActionScript 3.0
Posted 31 December 2008 - 11:26 PM
If you are loading a swf into another swf (like galleries or video thingies may do) then you could close the loaded one with something like so:
If you are tyring to close the window that containes the swf, you may be able to use this:
I know it works in AS2.0, but am not sure aobut AS3.0...
Hope that helps.
removeChild(yourLoadedSwf);
If you are tyring to close the window that containes the swf, you may be able to use this:
fscommand("quit", true);
I know it works in AS2.0, but am not sure aobut AS3.0...
Hope that helps.
#5
Re: Closing Flash Movie with ActionScript 3.0
Posted 31 December 2008 - 11:42 PM
fscommand(command:String,args:String):void
Do you know what the args argument means?
fscommand("quit"); works..
It only works in the Flash Player though. I mean, it closes the swf window when I opened the file from my computer, but when I open my swf in a browser it won't do anything. If it is possible to make this work in a browser, then you'd help me even more!
Do you know what the args argument means?
fscommand("quit"); works..
It only works in the Flash Player though. I mean, it closes the swf window when I opened the file from my computer, but when I open my swf in a browser it won't do anything. If it is possible to make this work in a browser, then you'd help me even more!
#6
Re: Closing Flash Movie with ActionScript 3.0
Posted 01 January 2009 - 12:11 AM
Um, maybe. You iwll have to get a JS/Flash communications library and use the Javascript window.close() function.
HTH
HTH
#7
Re: Closing Flash Movie with ActionScript 3.0
Posted 01 January 2009 - 01:09 AM
I found some code on gotoAndLearn() Flash Forums that should close the browser window:
I think we're pretty close here, but it doesn't work yet.
function btnExitClickHandler(event:MouseEvent):void
{
//fscommand("quit");
var req:URLRequest = new URLRequest("java script:window.close();");
navigateToURL(req, "_self");
}
I think we're pretty close here, but it doesn't work yet.
This post has been edited by skater_00: 01 January 2009 - 02:57 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|