1 Reply Latest reply on Jan 7, 2009 5:16 AM by seRajan

    How to dispatch events from custom AS3 classes to MXML

    VilleMustonen
      Hello,

      I introduce some custom classes inside my SCRIPT tag in MXML. These classes should dispatch custom Events (or any events for that matter) and the listeners should be defined inside the SCRIPT tag.

      In the custom class I have:
      quote:

      dispatchEvent(new Event("customEvent"));


      And inside the script tag:
      quote:

      addEventListener("customEvent", testListener);

      quote:

      public function testListener(evt:Event):void{
      Alert("Event fired successfully.");
      }


      However, this event is not handled in the listener (the alert is not shown). What could be wrong?