1 person found this helpful
Trace will try to evaluate everything to a string so target.toString() is called.
On the next line you're trying to add a string to an object. The following might work better (assumes ButtonNameOn is a variable on the current document)
this[target.toString() + "On"].alpha = 1
Flex SDK Developer
Adobe Systems Inc.
Thanks for getting back to me. I used your code:
var target = e.currentTarget;
trace(target + "On");
this[target.toString() + "On"].alpha = 1;
And it builds just fine. However, when I click the button it throws ReferenceError: Error #1069: Property AnimTest0.HBox6.refineBtnOn not found on AnimTest and there is no default value...
Could it be because it's not expecting a string? Anyone know what else needs to be done?
if u haven't defined the type for target then target will said to have the button object in which the event has happened.
as said in the post trace deals only with strings, hence the concatenation works.
in the line target.tostring+"on".alpha u r accessing a undefined object buttonon property alpha;
u can't append strings to object refrences and access other objects.
if this post answers mark as such