6

I have an AS3 Object: {p1:"..", p2:".."} I want con create another object that contains the first one in a property whose name is defined by a variable:

var propertyName:String = "myName";
var myObj = new Object();
myObj.something_that_creates_a_property_named_as_propertyName({p1:"..", p2:".."})

does it make any sense?

Jacob Poul Richardt
  • 3,145
  • 1
  • 26
  • 29
luca
  • 12,311
  • 15
  • 70
  • 103

1 Answers1

15
var propertyName:String = "myName";
var myObj = new Object();
myObj[propertyName] = {p1:"..", p2:".."};
Michael
  • 276
  • 2
  • 2