0 Replies Latest reply on Aug 8, 2011 2:38 AM by cstu015

    Mobile App event listener

    cstu015

      Hi

       

      I'm having trouble getting an event listener to work in a mobile app (Built in Flash Builder 4.5, Flex SDK 4.5.1)

       

      I have an event class called BMS_Event.as which looks like this:

       

      package model

      {

      import flash.events.Event;

       

      public class BMS_Event extends Event

      {

       

      public static var COMPLETE_EVENT:String = "BMSData_Complete";

       

      public static var FAULT:String = "BMSDatafault";

       

      public var data:*;

       

      public function BMS_Event(type:String, data:*=null, bubbles:Boolean=false, cancelable:Boolean=false)

      {

      this.data = data;

      super(type, bubbles, cancelable);

      }

       

      }

      }

       

      An Event Dispatcher class which looks like:

       

      package model

      {

      import flash.events.Event;

      import flash.events.EventDispatcher;

       

      import model.BMS_Event;

       

      public class BMSDataParser extends EventDispatcher

      {

      public function BMSDataParser()

      {

      trace("BMSDataParser function");

      var BMSDataCompleteEvent:BMS_Event = new BMS_Event(BMS_Event.COMPLETE_EVENT);

      dispatchEvent(BMSDataCompleteEvent);

      }

      }

      }

       

      And in my App view, two functions to call the eventparser, and then an eventlistener which listens for the complete event:

       

      <fx:Script>

      <![CDATA[

      import model.BMSDataParser;

      import model.BMS_Event;

      protected function getData():void

      {

      bms.send();

      var parser:BMSDataParser = new BMSDataParser();

      parser.addEventListener(BMS_Event.COMPLETE_EVENT, bmstest);

      }

       

      private function bmstest(e:BMS_Event):void

      {

      trace("bmstest function");

      }

      ]]>

      </fx:Script>

       

      The problem I'm having is that the event listener isn't firing, everything works fine up until that point.  It does work in a web application, but for whatever reason not a mobile app.

      I'm new to mobile app development - is this a limitation of AIR mobile Apps?

       

      Any help/suggestions greatly appreciated.

      Thanks