How do I define a static constructor that is run when class is initialized ?
I can't get it right:
// version a:
{}
// version b:
static {}
// version c:
static function Foo()
{}
// version d:
static ()
{}
// version e:
()
{}
// version f:
static function Foo():void
{}
Found it out:
public class Test
{
public function Test()
{
trace("normal constructor");
}
// static constructor (version a)
{
trace("static constructor");
}
}
For some reason no question was asked about static constructor in AS-3 ?
public class Test extends Sprite
{
trace("hello world");
public function Test()
{
trace("constructor");
}
trace("bye world");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With