简体   繁体   中英

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM