1 Reply Latest reply on Feb 5, 2007 9:17 AM by _Albertx_

    Events getting lost during bubble

    Dr._Goomba Level 1
      I have spent one too many hours fooling around with this. This is just a simple test, but I have an mxml component named Test.mxml that is dispatching an event. I also have a FrontController.as that is listening for events. When an event is dispatched in Test, FrontController is not responding to it. When the code is placed into one file it works dandy, so i am not sure where the problem lies. I am invoking FrontController at the Application. Thanks for helping me out on this. Its driving me mad.

      Here are my files:

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" xmlns:control="controller.* xmlns:nav="views.nav.*">

      <!-- Controller: Controls all application events -->

      <nav:navigation top="8" left="9" right="90" bottom="609"/>


      package controller
      import mx.core.Application;
      import flash.events.Event;

      public class FrontController
      // Get a reference to the Application object here
      private var app:Main = Application.application as Main;

      public function FrontController(){
      app.addEventListener("SomeEvent", someHandler);

      private function someHandler(e:Event):void{
      trace("Hello my name is Borat");

      <mx:TitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*"

      [Event(name="SomeEvent", type="flash.events.Event")]


      import flash.events.Event;
      import flash.events.EventDispatcher;

      private function initComp():void{
      var eventObj:Event = new Event("SomeEvent");
        • 1. Events getting lost during bubble
          _Albertx_ Level 1
          But... Here I can see that your listening for events wich are dispatched by the Application not your Test.mxml component. So, if the App dispatches an Event your front controller will be able to catch it, but if another component (like you Test.mxml) dispatches an event your front controller will not be able to catch it.

          Also I can see that your not making reference to your Test.mxml component in your application.