Tintin
Tintin

Reputation: 2973

how to create a xmllist variable in flex?

I am trying to create a xmllist variable in action script like this:

var _menuData:XMLList;              
                <menuitem label="File">
                    <menuitem label="Backup Schedule"/>
                    <menuitem label="Restore Schedule"/>                    
                </menuitem>
                <menuitem label="Edit">
                    <menuitem label="Cut"/>
                    <menuitem label="Copy"/>
                </menuitem>

How do I assign this xml to _menuDAta in actionScript? I dont want to create a string first and then do it all by fixing line break errors. Thanks.

Upvotes: 1

Views: 1676

Answers (2)

tptd
tptd

Reputation: 1

var xmlList:XMLList = <><item>1</item><item>2</item><item>3</item></>;
trace(xmlList);

Upvotes: -2

robertp
robertp

Reputation: 3642

I can't see your code here but here is a sample code for creating an XMLList:

var xml:XML = <items><item>1</item><item>2</item><item>3</item></items>;
var xmlList:XMLList = xml.item;
trace(xmlList);

Hope it helps, Rob

Upvotes: 3

Related Questions