Are you sure you are listening for the same event type in main? From what I can 
see your custom event is of type
"formSubmitted" while the main listens for "formUpdate" ...

Claudiu



----- Original Message ----
From: Mark Hosny <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, October 17, 2008 4:59:55 PM
Subject: [flexcoders] custom event not working in popup


Hey guys,

I now know that my custom event is not working properly in my popup window when 
listening for the event in the main app. When I do this, it works:

POPUP WINDOW
<mx:Metadata>
[Event(name= "formUpdate" ,type="flash. events.Event" )]
</mx:Metadata>

dispatchEvent(new Event('formUpdate',true));

MAIN APP
application. systemManager. addEventListener ("formUpdate",handleUpdateFormSu 
bmitted);

private function handleUpdateFormSub mitted(event: Event):void {
Alert.show('SUCCESS');
}

When I use a custom event it doesn't work:
<mx:Metadata>
[Event(name= "formUpdate" ,type="com. event.CustomEven t")]
</mx:Metadata>

var evt:CustomEvent = new CustomEvent( CustomEvent. ON_TEST_CASE,
        {
        memberID:memberID_ txt.text
        }
        );
 this.dispatchEvent( evt);

MAIN APP
application. systemManager. addEventListener ("formUpdate",handleUpdateFormSu 
bmitted);

private function handleUpdateFormSub mitted(event: CustomEvent) :void {
Alert.show('SUCCESS');
}

CUSTOM EVENT
package com.event

{
    import flash.events. *
   

    public class CustomEvent extends Event
    {
    

//- PUBLIC & INTERNAL VARIABLES ------------ --------- --------- --------- 
--------- --------- --------- ---------
       

        // event constants
        public static const ON_TEST_CASE: String = "formSubmitted";
       

        public var params:Object;

        public function CustomEvent( $type:String, $params:Object, 
$bubbles:Boolean = true, $cancelable: Boolean = true)
        {
            super($type, true, $cancelable) ;
           

            this.params = $params;
        }
       


   

        public override function clone():Event
        {
            return new CustomEvent( type, this.params, bubbles, cancelable);
        }
       

        public override function toString():String
        {
            returnformatToString("CustomEvent", "params", "type", "bubbles", 
"cancelable");
        }
   

//- END CLASS ------------ --------- --------- --------- --------- --------- 
--------- --------- --------- ---------
    }

}

Thanks,

Hoz



    

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to