Reputation: 3630
Is it possible to add an event listener for Alert.show
?
So that every time an alert box is shown I can call a function to hide an iframe.
Upvotes: 1
Views: 301
Reputation: 6586
Alert.show will return you the instance of the alert object. Use the object to add event listeners on the alert.
var alert:Alert = Alert.show("contente");
alert.addEventListener(Event.Close, function(e:Event):void{
// TODO
);
Upvotes: 0
Reputation: 412
I think you will get stuck since event dispatching/listening will require using an instance of a class to be the dispatcher, which is not the case when using the static .show().
However, I guess you could manually dispatch an event every time you want to close your iframe and display an alert (both could be done by the event dispatched).
You could as well create your own class that would have a .showAlert function performing both the event dispatching and the regular Alert.show(). This requires your custom class to be instantiated but the instance could also be stored in a Singleton so you don't have to recreate a new one every time you want to display your Alert.
Upvotes: 1