PDA

View Full Version : Class Question



jgallen23
May 29th, 2007, 11:29 AM
Is there any difference in doing something like



public class Blah extends Sprite
{
var _test:TextField = new TextField();

public function Blah():void()
{
}
}


vs



public class Blah extends Sprite
{
var _test:TextField;

public function Blah():void()
{
_test = new TextField();
}
}


just wondering which method is correct (if there is a correct way)

senocular
May 29th, 2007, 11:46 AM
Not in AS3. Both are basically the same. You would want to instantiate in the constructor if you are using constructor arguments to dictate that instantiation, though.