Hi!
I have question about haxe language. Ideally I want a class which extend Sprite with dynamic acess (like MovieClip in AS3).
Is it possible?
As an alternative I want to create class with array access something like this:
class MySprite extends Sprite
{
@:arrayAccess
public inline function get(code:String) {
return this.getChildByName(code); // get
}
}
or
class MySprite extends Sprite
{
private var _properties = new Map<String, Any>();
@:op([]) public function propRead(code:String)
return _properties[code]; // get
@:op([]) public function propWrite(code:String, value:Any)
{
_properties[code] = value; // set
return value;
}
}
But it does not work as I expected.
I have own gui constructor from json which is generated from .FLA. I can construct MySprite and add fields aka child names so I can write something like:
var mySprite:MySprite = Gui.construct("scene1");
mySprite.childName.childName.childName.textFieldName.text = "message";
or
mySprite['childName']['childName']['childName']['textFieldName'].text = "message";
Thx for advices!