Ok, good.  Now, each item in the first combo box has an XML "location"
node in it.  If the location node contains the child nodes necessary to
populate the second combo, then in the "listChangeHandler" do something
similar to what you did in the result handler. You can directly assign
the dataProvider instead of using an instance variable:

 

var xmlLocation:XML = XML(event.target.selectedItem); //or use the "as"
operator

var xlNames:XMLList = xmlLocation.Name;

cboNames.dataProvider = xmNames;

 

Do the same in the Names combobox handler to populate the third combo
and the Tree, or whatever.

 

While this would be my approach, you could also use binding to populate
the comboboxes, something like:

<mx:ComboBox id=" cboNames" dataProvider="{ mybox1.selectedItem.Name}"
../>

Binding is just a little harder to debug, becaue using the handler
function you can trace xmlLocation.toXMLString() to know exactly how to
reference the child nodes.

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of dranoel1967
Sent: Monday, January 01, 2007 8:29 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Multiple ComboBox Selection and Tree from XML

 

I have managed to get this to work, I had to reformat my xml data file.
Now that I have 
that working, how would I capture the users selection to populate the
second and and 
then the third combobox.

Thank you for the previous post and direction.

Regards,

<!---end of code-->

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " layout="absolute" 
xmlns:adobe="http://www.adobe.com/2006/fc <http://www.adobe.com/2006/fc>
"
initialize="e4xService.send()">

<mx:HTTPService id="e4xService"
url="data/data.xml"
result="resultHandler(event)"
resultFormat="e4x"/>

<mx:Script>
<![CDATA[
import mx.events.ListEvent;
import mx.rpc.events.ResultEvent;

[Bindable]
private var xmlData:XMLList;
[Bindable]
private var selectedXML:XML;

private function resultHandler(event:ResultEvent):void
{
var result:XML = event.result as XML;
xmlData = result..location as XMLList;
}

private function listChangeHandler(event:Event):void 
{
}

]]>
</mx:Script>



<mx:MenuBar x="10" y="10" width="780" height="72" cornerRadius="5"></
mx:MenuBar>
<mx:HDividedBox x="10" y="90" width="780" height="352">
<mx:Panel width="386" height="352" layout="absolute" title="myQuest" 
fontFamily="Verdana">

<mx:ComboBox id="mybox1"
dataProvider="{xmlData}"
labelField="@label"
width="157" x="10" y="92"
change="listChangeHandler(event)"/>

<!---end of code-->

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> If the data can be in one file then that is the easiest way to do it.
> 
> 
> 
> Use HTTPService with resultFormat="e4x" to get the data into Flex.
> 
> Then use an e4x expression to return an XMLList of the correct nodes
for
> the first combo box.
> 
> 
> 
> When you have that working, post back.
> 
> 
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of dranoel1967
> Sent: Friday, December 29, 2006 1:24 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: Multiple ComboBox Selection and Tree from
XML
> 
> 
> 
> I will be using this xml file, I'm very open to changes... I have
> several other "Locations" to 
> add 18 in all. My first thought was to create a seperate xml file for
> each, but as you see I 
> currently have then in one large file.
> 
> Thanks again,
> 
> <!---start of xml file -->
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Locations>
> <Location>
> 
> <Name>myLocation 1</Name>
> <ID>1</ID>
> <Organization> 
> <Name>Organization 1</Name>
> <ID>2</ID>
> <Role>
> <Name>RoleName 1</Name>
> <Assignment>
> <Name>myAssign 1</Name>
> <Sub>
> <Name>myAssign SubName 1</Name>
> <ID>1</ID>
> <Description><![CDATA[<P ALIGN="LEFT"><FONT 
> LETTERSPACING="0" KERNING="0">You determine the resource impact of
pends
> <FONT 
> COLOR="#0000FF">This is a full description of this Assignment's Sub
> Category.</
> FONT></P>]]></Description>
> <RoleProfile>http://www.newURL.com <http://www.newURL.com>
<http://www.newURL.com <http://www.newURL.com> >
> </RoleProfile>
> <AntLearn><![CDATA[<P ALIGN="LEFT"><FONT 
> LETTERSPACING="0" KERNING="0">Experience communicating through e-mail
> and 
> leading meetings with confidence. </FONT></P>]]></AntLearn>
> <OpenPosition>http://www.newURL.com <http://www.newURL.com>
<http://www.newURL.com <http://www.newURL.com> > </
> OpenPosition>
> </Sub>
> <Sub>
> <Name>myAssign SubName 2</Name>
> <ID>2</ID>
> <Description><![CDATA[<P ALIGN="LEFT"><FONT 
> LETTERSPACING="0" KERNING="0">Our Online Web Information Exchange.
This
> is your 
> one-stop resource for learning the latest news about us and our
> industry, as well as the 
> place to access information and tools to help you with your
professional
> and personal 
> life.</FONT></P>]]></Description>
> <RoleProfile>insert intranet url</RoleProfile>
> <AntLearn>Insert your full text here</AntLearn>
> <OpenPosition>http://www.newUrl.com <http://www.newUrl.com>
<http://www.newUrl.com <http://www.newUrl.com> > </
> OpenPosition>
> </Sub>
> 
> </Assignment>
> </Role>
> </Organization>
> 
> </Location>
> <Location>
> <Name>myLocation 2</Name>
> <ID>2</ID>
> <Organization> 
> <Name>Organization 2</Name>
> <ID>2</ID>
> <Role>
> <Name>myRoleName 2</Name>
> <Assignment>
> <Name>MyNextAssign</Name>
> <Sub>
> <Name>MyNexAssign Sub1</Name>
> <ID>2</ID>
> <Description><![CDATA[<P ALIGN="LEFT"><FONT 
> LETTERSPACING="0" KERNING="0">You determine the resource impact of
pends
> <FONT 
> COLOR="#0000FF">This is a full description of this Assignment's Sub
> Category.</
> FONT></P>]]></Description>
> <RoleProfile>http://www.newIntranetURL.com
<http://www.newIntranetURL.com> 
> <http://www.newIntranetURL.com <http://www.newIntranetURL.com> > </
> RoleProfile>
> <AntLearn><![CDATA[<P ALIGN="LEFT"><FONT 
> LETTERSPACING="0" KERNING="0">Experience communicating through e-mail
> and 
> leading meetings with confidence. </FONT></P>]]></AntLearn>
> <OpenPosition>http://www.newURL.com <http://www.newURL.com>
<http://www.newURL.com <http://www.newURL.com> > </
> OpenPosition>
> </Sub>
> <Sub>
> <Name>MyNextAssign sub2</Name>
> <ID>4</ID>
> <Description><![CDATA[<P ALIGN="LEFT"><FONT 
> LETTERSPACING="0" KERNING="0">You coach and mentor associates on the
> network 
> admin and data entry teams, serving as an important role
> model.</FONT></P>]]></
> Description>
> <RoleProfile>insert intranet url</RoleProfile>
> <AntLearn><![CDATA[<P ALIGN="LEFT"><FONT 
> LETTERSPACING="0" KERNING="0">Your anticipated learning's will go
> here.</FONT></
> P>]]></AntLearn>
> <OpenPosition>http://www.newURL.com <http://www.newURL.com>
<http://www.newURL.com <http://www.newURL.com> > </
> OpenPosition>
> </Sub>
> </Assignment>
> </Role>
> </Organization>
> 
> </Location>
> </Locations>
> 
> <!---end of xml file -->
> 
> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> , "Tracy Spratt" <tspratt@> wrote:
> >
> > That is clear. The general solution is to bind the dependant combo
> > box's dataProvider to the selectedItem in its precedent control, or
to
> > have the change event of each combo box set the dataProvider for the
> > dependant control. The exact implementation depends on several
> factors.
> > 
> > 
> > 
> > How is your data organized, and how are you getting it from the
> server?
> > Specifically, does each comboBox selection need to trigger a data
> > service call to get the result data for the dependent combo? Or can
> you
> > get all the data or parts of the data at once?
> > 
> > 
> > 
> > Tracy
> > 
> > 
> > 
> > ________________________________
> > 
> > From: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> [mailto:flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of dranoel1967
> > Sent: Thursday, December 28, 2006 5:38 PM
> > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> 
> > Subject: [flexcoders] Multiple ComboBox Selection and Tree from XML
> > 
> > 
> > 
> > Multiple ComboBox Selection from XML
> > 
> > Okay, I am looking for some help, or an example even a nod in the
> right
> > direction wouldl be 
> > much appreciated.
> > 
> > I have three combo boxes and a tree that I need to populate from an
> XML
> > file.The first 
> > combox 1 will need to have data ready for selection upon load. Then
> > combobox 2 will then 
> > be populated with all associated child nodes from the selection in
> > combobox 1, and 
> > combobox 3 will then be populated with all associated child nodes
from
> > the selection in 
> > combobox 2. Once the user makes their final selection in combobox 3
> the
> > tree will be 
> > populated with that childs data.
> > 
> > I am sure that this is as clear as mud! :)
> > 
> > Being very new to xml and Flex any examples and or suggestions would
> be
> > great.
> > 
> > Best Regards,
> > 
> > Dranoel
> >
>

 

Reply via email to