I am trying to create two var one var is a object that gets another object inside the same class
package plus1
{
public class ScreenInfo
{
//setting a button to 0 means that it is disabled
public var object:Object = { button1:_Object2 };
public var _Object2:Object = { name:"test name" };
public function ScreenInfo()
{
}
}
}
but ever time i do this
var screens:ScreenInfo = new ScreenInfo();
var obj:Object = screens.object["button1"]
the object is null why is this shouldn’t it pass me the second object?
Because you are using variable initializers, you can’t safely use references to other members. How do you know that
_Object2exists when you createobject?I suggest you move the instantiation of
objectin the constructor of your class :