Return to Snippet

Revision: 24293
at November 24, 2010 02:41 by weavermedia


Updated Code
var mc:MovieClip = new MovieClip(); // make new object

// these strings can come from flashvars, arrays etc
var n:String = "tallness"; // this is the property
var v:String = "100 miles"; // this is the value for the property

// assign the property and value at the same time
mc[n] = v;

trace(mc.tallness); // traces: 100 miles

Revision: 24292
at February 25, 2010 10:37 by weavermedia


Initial Code
var mc:MovieClip = new MovieClip(); // make new object

// these strings can come from flashvars, arrays etc
var n:String = "tallness"; // this is the property
var v:String = "100 miles"; // this is the value for the property

assign the property and value at the same time
mc[n] = v;

trace(mc.tallness); // traces: 100 miles

Initial URL

                                

Initial Description

                                

Initial Title
Add properties dynamically from strings

Initial Tags

                                

Initial Language
ActionScript 3