Currently i'm using this code:

.................................................................
private var _contactConfirmRemove:Contact;

private function removeContact_listener(event:ContactEvent):void {
        var contact:Contact = event.contact;
        this._contactConfirmRemove = contact;   
        Alert.show(
                "Are you sure you want to delete the contact:\n" + 
contact.firstName
+ " " + contact.lastName + "?", // text
                "Delete Contact", // title
                Alert.YES|Alert.NO, // flags
                null, // parent
                removeContactConfirm, // clickListener
                null, // iconClass
                Alert.NO // defaultButton
        );
}
private function removeContactConfirm(event:CloseEvent):void {
        var contact:Contact = this._contactConfirmRemove;
        if(event.detail == Alert.YES) {
                this.contactManager.remove(contact);
        }
        this._contactConfirmRemove = null;
}
.................................................................

I'm setting the event listener of the Alert box to
removeContactConfirm. I need to pass my Contact variable to this event
listener. I'm currently setting it to a class variable so I can later
access it in the removeContactConfirm function. However, I'd prefer to
just pass it directly to the removeContactConfirm event listener,
rather then temporarily set it to a class var and access it later.

But the way you specifiy an event listener for the Alert box doesn't
allow you to pass extra information. Is there a way to do this? I was
thinking about creating a custom event that extends the CloseEvent
that holds extra data. But then I would also need to configure the
Alert box to dispatch that new custom CloseEvent instead, and I'm not
sure how to to do that.

Is this possible and if so, any pointers?

Reply via email to