i'm attempting to cast an object's property as an actual property of another object.
here's my object variable:
var propObj:Object = {prop:"width", width:50};
now i want to assign the property of a sprite using that object's properties.
var sp:Sprite = new Sprite();
sp.(propObj.prop as Sprite.property) = propObj.width;
now, i'm not even going to try that because i know the compiler will explode all up in my face. but you should be able to see what i'm trying to do.
why i'm trying to do it is because i'm reading in an XML file with an undetermined list of usable properties for specific objects. so instead of writing something like a huge switch statement to evaluate whether the XML file has a value for that specific property, i'm trying to assign properties dynamically based on what's available in the XML file.
if what i'm trying to do is possible, what's the best way to do it?