Threading or green threading in ActionScript?

I was wondering if there were any class or class libraries there, how to implement multithreading or green threading in ActionScript.

As you may have noticed, Scott Peterson is developing some kind of toolkit, but I did not find more information about this, except for its performance, in the Adobe MAX Chicago event.

Regards, Niklas

+3
source share
4 answers

Here is a green thread from Drew Cummins:

http://blog.generalrelativity.org/?p=29

+3
source

There is no built-in way to make green threads in ActionScript. You must write code to process it.

Make a function that performs one iteration of any operation you want to perform. It should return true or false depending on whether its work is being done or not. Now you need to calculate the time interval remaining until the next screen update in the ENTER_FRAME event. This can be done using flash.utils.getTimer.

start = getTimer(); //thread is a ui component added to system manager that is redrawn each frame var fr:Number = Math.floor(1000 / thread.systemManager.stage.frameRate); due = start + fr; 

Continue to fulfill your function by checking the return value of the function each time and checking if the time has been crossed out by comparing getTimer () with the proper one.

This was implemented in a useful class by Alex Haire in a blog post - Topics in ActionScript

+1
source

This is an old article , but the quasimondo method of running multiple swfs and then sharing data through LocalConnection may also be of interest. They said that back and forth from using LocalConnection can eat several loops, but if the iterations being handled are complex enough, this should not be too much of a problem.

+1
source

I'm a graphic guy, not a programmer, so I'm not sure if this will help you. BUT!

I make all my GUIs multi-frame "movies" and write each gui stream to a different frame. Make sure you only have 1-3 threads, and set the FPS to 30 or 60.

This is useful for small projects because its error tolerance and implementation are done for you.

-3
source

Source: https://habr.com/ru/post/885710/


All Articles