0

I'm sure this is a very basic question, but I'm just wondering if it's possible to create shared object and name it after a string variable.

For Example:

var newvariable:Number = 0;

so.data.newvariable.toString(); = ??

Now I know that with the above example /\ there are easier ways around it, but I really need to find out alternative methods so I can actually name the shared object after the variable. Really appreciate this!

user1666767
  • 117
  • 3
  • 13

1 Answers1

1

You can use array access brackets to create dynamic property names from variables:

var count:int = 0;
so.data["newvariable" + count] = "foo";
Aaron Beall
  • 49,769
  • 26
  • 85
  • 103