I have a custom button on which I want to listen to some custom
events.  For some reason in the following code my custom events are
never heard/triggered.

1)In the button's constructor I added the listeners as follows:

// Custom Class Code
public class testButton extends Button
{
//constructor           
     public function testButton {
        addEventListener (MouseEvent.MOUSE_OVER, handleMouseOver);              
                                                                        
// custom event
        addEventListener("addItemEvent", handleAddItemEvent);   
}
public function handleMouseOver (event:MouseEvent):void {                       
        // display as a tooltip
        this.toolTip = "Say Cheese";

public function handleAddItemEvent():void {                     
        // display as a tooltip
        Alert.show ("testButton Event: Add Item Event");


2) Parent Form Code (app.mxml)

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

// Code in test button to dispatch custom event
// 
private function triggerEventHandler():void {                        
 //Alert.show ("Broadcast Event");
        dispatchEvent(new Event("addItemEvent",true));
                }

This looks like it should work, but only the MouseOver event is ever
fired - am I missing something obvious?

TIA
Patrick





Reply via email to