I am using addProperty()
to dynamically populate a Class with getters. Here is a snippet of my code that does just that:
for (var i in options)
{
this.addProperty(i, getOption, null);
this._optionCount++;
}
//a little while later....
public function getOption()
{
return "hellO";
}
This is working successfully because when I call the following from the timeline (Thie previous code is part of a class called DropDown):
var options:Object = new Object();
options.one = "hello";
options.two = "goodday";
options.three = "yo";
options.four= "MEGA AMAZING";
options.five= "yo yo yo";
var drop1:DropDown = new DropDown(this.drop1, "red", options)
And attempt to trace out all of the properties in var drop1
by:
for (var i in drop1)
trace(i+" = "+drop1[i]);
I get the following:
_initY = -107
_mask = _level0.drop1.mask
_dropdown = _level0.drop1.options
_optionWidth = 143
_button = _level0.drop1
one = hellO
two = hellO
three = hellO
four = hellO
_optionCount = 5
five = hellO
_shadow = 8330268
_highlight = 9249057
Yet when I attempt to trace the following:
trace(drop1.one);
It gives me a compiler error saying:
There is no property with the name 'one'.
Does anyone know why I can't access this property?