1 Reply Latest reply on Jun 27, 2007 12:33 PM by Radu Cocieru


      I am newbie to flex. I have a project at hand that required handling huge amount of XML data. I get this data from remote service and i connect using XMLsocket. Problem is after connecting socket there are large number of data event at socket and UI freeze during this time becoz i need all the data to populate some components.

      Is there any other way of doing this... is there something like threading in flex?

      Thank you
        • 1. Re: Threading
          Radu Cocieru

          Flex uses FlashPlayer to interpret/run the code from SWF files, the way this code gets executed is per frame.

          Every frame some code gets executed and only per frame nothing in between them. So if you parse your XML all at once this means in one frame and if it takes longer than 1/FPS ( usually 24 fps) seconds than the client seems to be freezed.

          If you can parse your data in chunks as they com on the socket .. not all at once you can probably avoid the freeze.
          Another way to do it would be to spread the XML parsing over more frames ... it might take more time to parse the data, but the client will not freeze.

          With Flex components it is a bit tricky to do it, so I would suggest you create a class that extends an Sprite so it can be attached on the stage ... and than using the call later mechanism to spread the process over as many frames as it takes, than issue an event when the data is ready.

          Hope this helps ;)