I have often seen an init() within the constructor of AS3 classes, sometimes even being the only code in the constructor. Why would it be useful to do this, if you could simply use the constructor function itself to initialize a class?
package
{
import flash.display.Sprite;
public class Example extends Sprite
{
public function Example()
{
init();
}
public function init ( ):void
{
//initialize here
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…