开发者

Call on specific item in XML through flash

I want to know how you would call on a specific item in xml through flash? Here is my XML

<menu>
<day>
    <monday>            
        <maindish>
        <name>Curry Goat</name>
            <small>$6.86</small>
            <large>$9.00</large>
            </maindish>
    </monday>
    <tuesday>            
        <maindish>
        <name>Curry Goat</name>
            <small>$6.86</small>
            <large>$9.00</large>
            </maindish>
    </tuesday>
    <wednesday>            
      开发者_如何学JAVA  <maindish>
        <name>Curry Goat</name>
            <small>$6.86</small>
            <large>$9.00</large>
            </maindish>
    </wednesday>
</day>

This is the Code in Flash

for each (var maindish:XML in myXML..maindish)

How would a load the information for a specific day, lets say if it wednesday was selected.


 Is this what you are looking for?

 var menueXml:XML = <menu>  
 <day>      
 <monday>
 <maindish>         
 <name>Curry Goat</name>
 <small>$6.86</small>              
 <large>$9.00</large>
 </maindish>     
 </monday>      
 <tuesday>
 <maindish>
 <name>Curry Goat</name>
 <small>$6.86</small> 
 <large>$9.00</large>
 </maindish>      
 </tuesday>      
 <wednesday>
 <maindish>
 <name>Curry Goat</name>
 <small>$6.86</small>
 <large>$9.00</large> 
 </maindish>
 </wednesday>
 </day>
 </menu>;

 for each(var main in menueXml.day){
 trace(main.monday.maindish.name.text());
 trace(main.monday.maindish.small.text());
 trace(main.monday.maindish.large.text());
 trace(main.tuesday.maindish);
 trace(main.wednesday.maindish);
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜