[Flashcoders] How to Exit/Close the Web Browser from Flash Applications?

2009-08-07 Thread ITSCO

Hello,
How to Exit/Close the Web Browser from Flash  Applications?
Could anyone suggest a code to exit the flash application and  close the
web browser window?
I realize, the solution might be using ExternalInterface with  JS.  The
question is how?
The user can exit the flash application by clicking on an exit  button or
he/she can click on the Window “X”.
When clicking either on the “exit” button or on the Window “X”,  the
flash application will show an alert message, asking the user whether he/she
really want to exit.  Upon clicking  “yes” the application and web browser
will close.
Therefore, when the user clicks on the Window “X” the flash  application
needs to detect this click.
Thanks,
Daniel Abramovich
**A Good Credit Score is 700 or Above. See yours in just 2 easy
steps!
(http://pr.atwola.com/promoclk/100126575x1222846709x1201493018/aol?redir=http://www.freecreditreport.com/pm/default.aspx?sc=668072hmpgID=115bcd
=JulystepsfooterNO115)
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to Exit/Close the Web Browser from Flash Applications?

2009-08-07 Thread Jer Brand
Here's a simple example. Note that if you don't own the window your flash
is running in -- you opened it with window.open(...) --  this code will
again prompt the user if they really want to close the window in IE, or do
nothing (Firefox, chrome, etc).

There are ways around that, but I can't bring myself help others be evil.
;-)

Anyway:
--
in the flash:


import flash.external.ExternalInterface;

function onUserConfirmedTheyWantToExit():void
{
ExternalInterface.call(closeWindowAsync, ) ;
}


in the HTML page
script type=javascript
function closeWindowAsync()
{
setTimeout(closeWindowCallback(), 500) ;
}
function closeWindowCallback()
{
window.close() ;
}
/script




The use of setTimeout in the javascript is there because of some problems we
had calling window.close directly in IE6 (very weird IE-locking bugs if
there were other browser windows open).

Jer


On Fri, Aug 7, 2009 at 8:38 AM, it...@aol.com wrote:


 Hello,
 How to Exit/Close the Web Browser from Flash  Applications?
 Could anyone suggest a code to exit the flash application and  close the
 web browser window?
 I realize, the solution might be using ExternalInterface with  JS.  The
 question is how?
 The user can exit the flash application by clicking on an exit  button or
 he/she can click on the Window “X”.
 When clicking either on the “exit” button or on the Window “X”,  the
 flash application will show an alert message, asking the user whether
 he/she
 really want to exit.  Upon clicking  “yes” the application and web browser
 will close.
 Therefore, when the user clicks on the Window “X” the flash  application
 needs to detect this click.
 Thanks,
 Daniel Abramovich
 **A Good Credit Score is 700 or Above. See yours in just 2 easy
 steps!
 (
 http://pr.atwola.com/promoclk/100126575x1222846709x1201493018/aol?redir=http://www.freecreditreport.com/pm/default.aspx?sc=668072hmpgID=115bcd
 =JulystepsfooterNO115)
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to Exit/Close the Web Browser from Flash Applications?

2009-08-07 Thread Hans Wichman
The timeout is a good idea, I realized I stopped doing that somewhere along
the way, but especially macs as well had a knack for crashing if the calling
object was destroyed in the process of the call.

On Fri, Aug 7, 2009 at 4:15 PM, Jer Brand thejhe...@gmail.com wrote:

 Here's a simple example. Note that if you don't own the window your flash
 is running in -- you opened it with window.open(...) --  this code will
 again prompt the user if they really want to close the window in IE, or do
 nothing (Firefox, chrome, etc).

 There are ways around that, but I can't bring myself help others be evil.
 ;-)

 Anyway:
 --
 in the flash:


 import flash.external.ExternalInterface;

 function onUserConfirmedTheyWantToExit():void
 {
ExternalInterface.call(closeWindowAsync, ) ;
 }


 in the HTML page
 script type=javascript
 function closeWindowAsync()
 {
 setTimeout(closeWindowCallback(), 500) ;
 }
 function closeWindowCallback()
 {
 window.close() ;
 }
 /script

 


 The use of setTimeout in the javascript is there because of some problems
 we
 had calling window.close directly in IE6 (very weird IE-locking bugs if
 there were other browser windows open).

 Jer


 On Fri, Aug 7, 2009 at 8:38 AM, it...@aol.com wrote:

 
  Hello,
  How to Exit/Close the Web Browser from Flash  Applications?
  Could anyone suggest a code to exit the flash application and  close the
  web browser window?
  I realize, the solution might be using ExternalInterface with  JS.  The
  question is how?
  The user can exit the flash application by clicking on an exit  button or
  he/she can click on the Window “X”.
  When clicking either on the “exit” button or on the Window “X”,  the
  flash application will show an alert message, asking the user whether
  he/she
  really want to exit.  Upon clicking  “yes” the application and web
 browser
  will close.
  Therefore, when the user clicks on the Window “X” the flash  application
  needs to detect this click.
  Thanks,
  Daniel Abramovich
  **A Good Credit Score is 700 or Above. See yours in just 2
 easy
  steps!
  (
 
 http://pr.atwola.com/promoclk/100126575x1222846709x1201493018/aol?redir=http://www.freecreditreport.com/pm/default.aspx?sc=668072hmpgID=115bcd
  =JulystepsfooterNO115)
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to Exit/Close the Web Browser from Flash Applications?

2009-08-07 Thread Anthony Pace
Hello,

http://www.actionscript.org/resources/articles/638/1/Basics-of-using-the-ExternalInterface/Page1.html

http://www.actionscript.org/resources/articles/745/1/JavaScript-and-VBScript-Injection-in-ActionScript-3/Page1.html

The above links may be useful to you; yet, keep in mind that with popup
blockers being installed automatically and recommended to users in new
browsers, that what you want to do may not work 100% of the time, even
with user interaction, because calls to open and close are heavily
scrutinized.

Thanks,
Anthony

it...@aol.com wrote:
  
 Hello, 
 How to Exit/Close the Web Browser from Flash  Applications? 
 Could anyone suggest a code to exit the flash application and  close the 
 web browser window? 
 I realize, the solution might be using ExternalInterface with  JS.  The 
 question is how? 
 The user can exit the flash application by clicking on an exit  button or 
 he/she can click on the Window “X”.
 When clicking either on the “exit” button or on the Window “X”,  the 
 flash application will show an alert message, asking the user whether he/she  
 really want to exit.  Upon clicking  “yes” the application and web browser 
 will close. 
 Therefore, when the user clicks on the Window “X” the flash  application 
 needs to detect this click.  
 Thanks, 
 Daniel Abramovich
 **A Good Credit Score is 700 or Above. See yours in just 2 easy 
 steps! 
 (http://pr.atwola.com/promoclk/100126575x1222846709x1201493018/aol?redir=http://www.freecreditreport.com/pm/default.aspx?sc=668072hmpgID=115bcd
 =JulystepsfooterNO115)
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

   
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders