Dhana
Dhana

Reputation: 189

Pseudo Multithreading in Flex

I know Flex or Actionscript doesnt support multithreading.. but one of my project requires multithreading.. is there a way to mimic multithreading in Actionscript..

Upvotes: 1

Views: 1673

Answers (4)

orlade
orlade

Reputation: 2090

I'm guessing you have a large amount of processing to do but would like the UI to refresh during this process? I had the same problem trying to parse a massive chunk of XML - it would take about a minute and lock the browser, before eventually throwing a timeout exception.

There's a great example here on a pseudo-multi-threaded solution for editing a bitmap image. It's for Flex 4, but the static UIUtilities class is what you're interested in, and it works fine in Flex 3. Simply break your task up into chunks and call pausingFor() and fiddle with the arguments. Very simple and effective once you've got it going.

HTH!

Upvotes: 2

maxmc
maxmc

Reputation: 4216

this is an interesting article on the topic green threads

Upvotes: 2

splash
splash

Reputation: 13327

The Flex RPC components are working asynchronous. So if your application is working with a service back-end you could make it threadable by delegating the work to the server.

Upvotes: 1

Peter Tillemans
Peter Tillemans

Reputation: 35341

As flex et al are event driven, can't you use a timer task which does chunks of the work and be triggered every couple 100 of ms?

Upvotes: 0

Related Questions