Use a variable's value as the element name to find
package{ import flash.display.Sprite;
public class Main extends Sprite{ public function Main(){ var nodeName:String = "color"; var fruit:XML = <fruit><color>red</color></fruit>; trace( fruit[nodeName] ); } } }
Related Scripts with Example Source Code in same category :