PDA

View Full Version : Please help !



FlashDever
October 11th, 2009, 06:55 PM
Hello

I keep getting the following error msg below I would be very happy if some knows the solution to this:

Error Msg:

1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.events:Event

Object A dispatches Event as:


dispatchEvent({type:MainMenuEvents.EVENT_MENU_SELE CTED, dataObj:"BMW"});




Object B adds the event listener:




menu.addEventListener(MainMenuEvents.EVENT_MENU_SE LECTED, this.showChanged);



Object B contains the event handler:



public function showChanged(event:Event):void{

trace(event.dataObj);

}



Thanks

sparkdemon
October 11th, 2009, 07:01 PM
I believe this is not a as3 event. its a typical as2 event dispatcher technique. If you are using this in as3. You will definitely get error.

dtk13
October 11th, 2009, 07:44 PM
dispatchEvent({type:MainMenuEvents.EVENT_MENU_SELE CTED, dataObj:"BMW"});


Should be:


dispatchEvent(new MainMenuEvents(MainMenuEvents.EVENT_MENU_SELECTED, {dataObj:"BMW"}));