Build a property name and, consequently, an element name, dynamically
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var example:XML = <example />;
var id:int = 10;
// Create a string to incorporate the value of id in the node name
example[ "user" + id ] = "";
trace( example );
}
}
}
Related examples in the same category