RE: [flexcoders] What is the Flex solution to missing threads?

2007-05-30 Thread Tracy Spratt
The load is asynchronous and should not block the UI.

 

However, intense, long proccessing will block the UI.

 

A typical solution is to break the long process up into parts.  Maube
iterating i=_iIndex;i_iIndex+10;i++  then set _iIndex and use
callLater() to restart the incrementer.  callLater is critical becaue it
allows the UI to redraw before resuming the processing.

 

But the Flash Player is essentially single threaded.

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Aaron Wright
Sent: Wednesday, May 30, 2007 4:17 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] What is the Flex solution to missing threads?

 

I have an xml file that I load and parse. This parsing takes some
time. It takes enough time that the GUI blocks momentarily. Normally I
would send the xml parsing off in it's own thread but Flex does not
offer me that easy of a solution.

My question is, Is there a design pattern allowing long loops to not
block the GUI.

Flex being asynchronous is giving me some headaches.

 



Re: [flexcoders] What is the Flex solution to missing threads?

2007-05-30 Thread Robert Cadena
Hi Aaron,

you'll have to split up your function so that it performs work in small 
chunks then schedules itself to be called later with 'callLater'.

I ran into this problem when I wrote my syntax highlighting lib. So I 
split up the scanning function into a class of its own, with the 
previously local variables to the function as class data members.  I 
setup a timeout value during which the scanner can work.  If it goes 
past that value then it saves its state, calls callLater, and breaks 
out.

Good luck.

/r
http://www.searchcoders.com/flex/
http://www.machine501.com/



Aaron Wright wrote:
 I have an xml file that I load and parse. This parsing takes some
 time. It takes enough time that the GUI blocks momentarily. Normally I
 would send the xml parsing off in it's own thread but Flex does not
 offer me that easy of a solution.
 
 My question is, Is there a design pattern allowing long loops to not
 block the GUI.
 
 Flex being asynchronous is giving me some headaches.
 
 
 
 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
 Yahoo! Groups Links