2 Replies Latest reply on Apr 25, 2011 7:26 PM by THC Inc.

    UI refresh issue with external events

    THC Inc.

      I'm having a weird UI update issue. An event gets fired from an ActiveScript class that sets a Label on the UI side to a value. Even though the trace shows the value being changed, the UI is not updated to reflect the new value

       

      I have an ActiveScript Class that does some socket IO and occasionally dispatches an event using the global event dispatcher (defined below)

       

      private function ProcessData(Data:String):void{

      this.socketStatus = Data;

      trace("ProcessData", Data); //this is definitely called

      eventDispatcher.dispatchEvent(new Event(ONINFO));

      }

       

      I have a global event handler to handle events for the above file

       

      package 
      {
           import flash.events.IEventDispatcher;
           
           public function get eventDispatcher():IEventDispatcher
           {
                return _eventDispatcher;
           }
      }

      import flash.events.EventDispatcher;
      import flash.events.IEventDispatcher;

      var _eventDispatcher:IEventDispatcher = new EventDispatcher();

       

      Now in the UI (Status.mxml) the code is

       

      protected function view1_viewActivateHandler(event:Event):void

      {

       

           if (!GlobalVars.socketProcess)

           {

                GlobalVars.socketProcess = new SocketProcess();

                eventDispatcher.addEventListener(SocketProcess.ONINFO, SocketInfo, true);
           }

          

      }

       

      protected function SocketInfo(event:Event):void {

      trace("SocketInfo", GlobalVars.socketProcess.socketStatus); //this is definitely triggered by the event

      lblSocketStatus.text = "Status: " + GlobalVars.socketProcess.socketStatus;

      trace(lblSocketStatus.text); //this properly outputs the value set above


      }

       

       

       

      Now, I have a button on the UI that fires the SocketInfo event and the button does Update the UI. Am I missing something, I've tried everything I can think of, no outside call seems to make the UI update to reflect the text change of the Label.

       

      Tom