here is how:
two things to note here:
#1 – you could write this code as:
but I needed to pass my doSignOut eventhandler a parameter. In order to do this, I ended up passing an anonymous function and then calling my handler method in there.
#2 – The documentation for adobe air is great – sometimes. for example I googled “cancel air.Event.CLOSING” and this article came up: http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7ecf.html … I was ecstatic, there was even a header “Canceling default event behavior” which says “Call the
preventDefault() method to cancel the default behavior associated with an event.” which is exactly what I needed.
But it is never mentioned how to pass the calling event. I had always handled events using the syntax in #1 above, so for a little while there I thought to myself, “how the heck can I call preventDefault() on an event object that I don’t even have a handle on”.
After some tinkering with the syntax, I realized that I needed to pass an anonymous function anyways and give that function a parameter which would be the event.
Lastly, is it too much to ask for the documentation to give a code snippet – in this case, how to call
preventDefault() or is it more fruitful to leave it as an exercise for the user… eennhhh I don’t know.