2 Replies Latest reply on Aug 17, 2006 2:31 AM by DavidWhewell

    Bindable objects killing data stream

    DavidWhewell Level 1
      hi all,

      I was building a test application and came across seom very weird behaviour. In a nutshell, it's a simple MXML application with two TextAreas. It invokes an ActionScript class which starts an XMLSocket and connects to a server and processes data (non-XML data, but that's not the issue, it's coming down fine). The TextAreas are used to display stuff sent to the socket, and stuff received from the socket. The code for the ActionScript class is not much more complex than the XMLSocketExample class in the documentation.

      There is an intermediate class, the "handler" class, which the MXML calls with:

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      xmlns:feedHandler="feedHandler.*">
      <feedHandler:FeedTestHandler id="myFeed"/>

      the handler invokes the Feed class which creates the XMLSocket as mentioned above, and has hooks in its onData() and send() functions back to the handler. The handler functions simply append the new messages to two variables, and these variables are bound to the text values of the TextArea fields as so:

      <mx:TextArea y="170" left="10" right="10" height="100" id="ReceivedFromFeed" text="{myFeed.receiveFromFeedBind}"/>

      Now, everything works okay at first, the connection is made, the textAreas are populated, however, after receiving about 20 messages, it then stops processing - onData claims no more messages are coming in. No disconnection, no error, it just stops. However, if i comment out the one bit of this method in the handler:

      public function receiveFromFeed(s:String):void
      {
      receiveFromFeedBind += s;
      }

      which obviously changes the contents bound variable, which should trigger the TextArea above to update, the the data comes in down the socket indefinitely. So when it's updating the bound variable, the thing eventually stops processing, but when it doesn't update the bound variable, it doesn't get interrupted!

      Help? This is really weird and making me think I'm missing something about how to treat binding variables, I hope someone has some suggestions!

      Thanks in advance,

      David