6 Replies - 44904 Views - Last Post: 01 January 2009 - 01:09 AM

#1 skater_00  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 256
  • Joined: 30-April 08

Closing Flash Movie with ActionScript 3.0

Post icon  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.

init();

function init():void
{
	btnExitClip.addEventListener(MouseEvent.CLICK, btnExitClickHandler);
}

function btnExitClickHandler(event:MouseEvent):void
{
	// Close Flash Movie with "Exit" button
	// What comes here..?!
}

Is This A Good Question/Topic? 0
  • +

Replies To: Closing Flash Movie with ActionScript 3.0

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1147
  • View blog
  • Posts: 7,132
  • Joined: 07-September 06

Re: Closing Flash Movie with ActionScript 3.0

Posted 31 December 2008 - 11:16 PM

Is this for an AIR app? Or for swf?
Was This Post Helpful? 0
  • +
  • -

#3 skater_00  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 256
  • Joined: 30-April 08

Re: Closing Flash Movie with ActionScript 3.0

Posted 31 December 2008 - 11:20 PM

swf
Was This Post Helpful? 0
  • +
  • -

#4 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1147
  • View blog
  • Posts: 7,132
  • Joined: 07-September 06

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:

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.
Was This Post Helpful? 0
  • +
  • -

#5 skater_00  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 256
  • Joined: 30-April 08

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!
Was This Post Helpful? 0
  • +
  • -

#6 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1147
  • View blog
  • Posts: 7,132
  • Joined: 07-September 06

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
Was This Post Helpful? 0
  • +
  • -

#7 skater_00  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 256
  • Joined: 30-April 08

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:

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

Was This Post Helpful? 1

Page 1 of 1