How can I create a dynamic object from a string?
Here is my current code with incorrect results:
var s1:String = '{x:200, y:400}';
var o1:Object = Object(s1);
trace(o1); // result = {x:200, y:400}
trace(o1.x) // result = ReferenceError: Error #1069: Property x not found on String and there is no default value.
trace(o1.y) // result = ReferenceError: Error #1069: Property x not found on String and there is no default value.
I would like the previous code to output the following:
trace(o1); // result = [object Object]
trace(o1.x); // result = 200
trace(o1.y); // result = 400
Thanks in advance!