BackgroundWorkers and Gfx handling, in HTML5 etc

Hi,
I am wondering if BackgroundWorkers work asynchronously in HTML5 too or if they are still inlined by default. I need to execute a simple animation in the preloader, and I don’t want it to be influenced by the execution of the heavy initialization of the application.

Can BackgroundWorkers handle animations? Or they are intended for data computation only? I mean, can they be used i.e. for particle systems or background animations?

I suspect they can only elaborate data, and not elaborate gfx on the main application canvas, but I could be wrong.

Could they be used to execute the spritesheet parsing process (the frames extraction made through copyPixel in the Spritesheet library)?

My target is HTML5, but we could expand the discussion to other targets.

Thanks

We don’t have an implementation of BackgroundWorker that’s threaded on HTML5 right now, using Web Workers would be a nice addition here. In other targets, you do need to be careful about using graphic methods, because these are probably not thread-safe. That means you won’t want to modify the OpenFL display list, or a BitmapData that’s eligible to be rendered, within another thread. HTML5 may be more lenient here, if workers were implemented :slight_smile:

I wouldn’t know where to start from :thinking:

Can’t you use a gif image instead?

I’m pretty sure it would hang anyway.