2 Replies Latest reply on Aug 23, 2006 6:43 PM by

    Cannot listen event

      I found that if I have some time consuming tasks performed in one handler. Another event cannot be listened.

      public function eventhandler1(event:event1):void
      {
      time consuming tasks
      }

      public function eventhandler2(event:event2):void
      {
      sth actions
      }

      If event1 occurs first, the actions in eventhandler2 will never be performed.
      how can I resolve the problem?
      Thanks.

      Gavin
        • 1. Re: Cannot listen event
          dimival Level 1
          Are your handlers listening to the same event? If they do and they have the same priority, the handler that was registered first will execute first and so on, you can add a priority to your handlers when using the addEventListener method, the higher the priority the sooner that handler will execute. If you are not using priorities, all your handlers have the same and as i said, they execute in the order they were added.

          Hope it helps
          1 person found this helpful
          • 2. Re: Cannot listen event
            My handlers listen to different events and I assigned priorities to them.
            Actually, I am handling the socket event.
            The data which I receive from socket is quite large.
            And I need to extract and sort the data before another reading of bytestream from socket.
            When my program is extracting data, it is not able to listen the socket event.

            public function DataExtractHandler(event:DataEvent):void
            {
            a loop to extract data from buffer
            }

            public function SocketEventhandler(event:SocketEvent):void
            {
            read bytestream from socket to buffer
            }