Go Back   kirupaForum > Flash > ActionScript 3.0

Reply
 
Thread Tools Display Modes
Old 11-27-2009, 10:25 PM   #1
DBA
Registered User
How can I detect that the Flash Player is exiting?

I have written a basic chat client that talks to an XML Socket server. When it starts it connects to the socket and works fine. However, when I close the Flash Player it is still occupying a connection to the server.

I am trying to determine how I can trap the close of the Flash Player and programmatically close the connection to the server before the program exits.

Thanks in advance.
DBA is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 11-28-2009, 03:44 AM   #2
BeerOclock
Registered User
Thats very strange if Flash player can indeed maintain a connection even after it is closed...

I'm interested to see how you solve this. Sorry, no actual help though
BeerOclock is offline   Reply With Quote
Old 11-28-2009, 04:31 AM   #3
jase21
 
jase21's Avatar
Location Kerala, India

Posts 268
You need to listen to the CLOSE event.
I think..

Code:
myScoket = new XMLSocket();
mySocket.addEventListener(Event.CLOSE, disconnect);

function disconnect(event:Event):void
{
    //diconnect it..
}
[Edit]

there is Event.CLOSING, to detect whether a window is about to close and is fired before CLOSE event.
But its AIR only.

Last edited by jase21; 11-28-2009 at 04:42 AM.. Reason: [as] tag problem
jase21 is offline   Reply With Quote
Old 11-28-2009, 11:17 AM   #4
DBA
Registered User
Quote:
Originally Posted by jase21 View Post
You need to listen to the CLOSE event.
I think..

Code:
myScoket = new XMLSocket();
mySocket.addEventListener(Event.CLOSE, disconnect);

function disconnect(event:Event):void
{
    //diconnect it..
}
[Edit]

there is Event.CLOSING, to detect whether a window is about to close and is fired before CLOSE event.
But its AIR only.
Thanks for your reply. Unfortunately, the socket CLOSE event is only fired when the socket server disconnects. I am looking for the event that fires when the client is shutting down so I can close the socket connection from the client side.
DBA is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:45 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com