You also need to change = to == in your E4X filter. A working example is below.

- Gordon

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
        
        <mx:Script>
                <![CDATA[
                        
                        private var stateCountyData:XML =
                                <data>
                                        <state label="Texas" data="Texas">
                                                <county label="Jones" 
data="123" />
                                                <county label="Taylor" 
data="124" />
                                        </state>
                                        <state label="Virginia" data="Virginia">
                                                <county label="Alexandria" 
data="223" />
                                                <county label="Arlington" 
data="224" />
                                        </state>
                                </data>;
                                
                        private function setStates():void
                        {
                                stateCombo.dataProvider = stateCountyData.state;
                        }
                        
                        private function setCounties():void
                        {
                                countyCombo.dataProvider = 
stateCountyData.state.(@label == stateCombo.selectedLabel).county;
                        }

                ]]>
        </mx:Script>
        
        <mx:ComboBox id="stateCombo" labelField="@label" width="200"
                                 creationComplete="setStates(); setCounties()"
                                 change="setCounties()"/>
                                 
        <mx:ComboBox id="countyCombo" labelField="@label" width="200"/>

</mx:Application>

________________________________________
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael 
Labriola
Sent: Friday, October 20, 2006 11:07 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: E4X Help


Tangent,

Remove the {} from around selected :

var counties:XMLList = _myXml.state.(@label=selected).county;

Mike

--- In flexcoders@yahoogroups.com, "Tan" <[EMAIL PROTECTED]> wrote:
>
> I try writing two comboboxes to facilitate selection of the
following XML,
> 
> <data>
> <state label="Texas" data="Texas">
> <county label="Jones" data="123" />
> <county label="Taylor" data="124" />
> ...
> </state>
> <state label="Virginia" data="Virginia">
> <county label="Alexandria" data="223" />
> <county label="Arlington" data="224" />
> ...
> </state>
> ...
> 
> 
> The first combo box is named _combo1 that is populated by state
data, and I
> want to get an XML or XMLList of the counties using AS3, I wonder
whether I
> can write it in E4X syntax that looks somewhat like
> 
> var selected:String = _combo1.selectedItem.toString();
> var counties:XMLList = _myXml.state.(@label = {selected}).county;
> 
> I get a compiler error for the last line, and I have searched
through some
> E4X samples, didn't seem to find any help. Any advice?
> 
> Thanks!
> 
> - Tangent
> 
> P.S. Or should I use XmlViewCollection, Descriptor or things like that?
>
 


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to