I had a quick question on static blocks in AS3.
I have a library that requires initialization statically before any application logic is executed. If I insert a static code block like the following, will this truly be executed before everything else? (ie: is it safe to assume that everything will be setup before the application starts?)
package {
import com.tkassembled.library.MyStaticLibrary;
import com.tkassembled.library.MyWorker;
import flash.display.Sprite;
public class Application extends Sprite {
// begin static code
/* initialize */ {
MyStaticLibrary.worker = new MyWorker();
}
public function Application() {
}
}
}
I would assume that the above code would execute in the following fashion:
- Load
Application
class, as it is the 'main executable'. - Load
MyStaticLibrary
andMyWorker
, executing any static blocks in them. - Execute the static blocks within
Application
. - Call the constructor and get things going.
Does anyone know if this is true or not? I guess I'll build an application to test it all out in the meantime :)