Dispatching custom event from a custom component


In Game.mxml File has "pref_event" Event

[Event(name="pref_event", type="PrefEvent")]

but your dispatching PrefEvent.GAME_CLICKED ("game_clicked").


You must dispatch the right event for this.

dispatchEvent( new PrefEvent("pref_event",gameid, true) );  

[Event(name="pref_event", type="PrefEvent")] != new PrefEvent(PrefEvent.GAME_CLICKED, gameid, true)

The name of the events are not the same.

You should write this in your Game.mxml file :

        [Event(name="game_clicked", type="PrefEvent")] 

And this in your main file :

<comps:Game id="game" x="0" y="0" game_clicked="gameClicked(event)" />

See here for further informations...