If you want to do something in AIR on the closing event of the application...

1 view
Skip to first unread message

shadowfist

unread,
Nov 4, 2009, 3:07:14 PM11/4/09
to Merapi
If you want to run code that may prevent the AIR application from
closing in the closing event and you don't want to have the bridge
close - you will have to do a few things.

1. you will have to add the event listener for the closing via code
and give it a priority greater than 0. You cannot use the
"closing=foo" in the mx:WindowedApplication tag. (e.g.
Application.application.addEventListener(Event.CLOSING,
onCloseAppHandler, false, 10, true);)

2. in your closing event handler, if you want to stop the bridge from
closing, you will have to call the event stopImmediatePropagation()
function. if you don't call this function on the event object, the
bridge will close.

by setting the priority of the event listener greater than 0, you
ensure that your closing event handler happens before the Bridge's
closing event handler. This will give you the opportunity to prevent
the bridge from closing.

Just an FYI that I figured out today.
Reply all
Reply to author
Forward
0 new messages