Adding Attributes to an XML Element : XML Object : XML Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » XML » XML Object »

 

Adding Attributes to an XML Element


 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){


        var example:XML = <example><someElement/></example>;
        
        example.someElement.@number = 12.1;
        example.someElement.@string = "example";
        example.someElement.@boolean = true;
        example.someElement.@array = ["a", null, 7, undefined, "c"];
        
        traceexample );
        
        example.someElement.@["bad-variable-name""yes";
        
        example.someElement.@["color" + num"red";

    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo XML
» XML Object