Posted By

weavermedia on 02/25/10


Tagged

dynamic property flashvars as3


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

weavermedia


Add properties dynamically from strings


 / Published in: ActionScript 3
 

  1. var mc:MovieClip = new MovieClip(); // make new object
  2.  
  3. // these strings can come from flashvars, arrays etc
  4. var n:String = "tallness"; // this is the property
  5. var v:String = "100 miles"; // this is the value for the property
  6.  
  7. // assign the property and value at the same time
  8. mc[n] = v;
  9.  
  10. trace(mc.tallness); // traces: 100 miles

Report this snippet  

You need to login to post a comment.