Thank you. Much appreciated.

John

-----Original Message-----
From: ericonanson [mailto:[EMAIL PROTECTED]
Sent: Saturday, 22 July 2006 12:59 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Populating ComboBox from Model/XML


Hi, here is something that works, if you know cold fusion then 
create a cfc that has the data you want and call it from a 
webservice, other wise populate an xml file and call that.

Step one;
Create xml file - name it mydata.xml
<?xml version="1.0" encoding="UTF-8"?>
        <obj>
                <item>
                         <label>AL</label>
                         <data>Montgomery</data>
                 </item>
                 <item>
                        <label>AK</label>
                        <data>Juneau</data>
                 </item>
                 <item>
                         <label>AR</label>
                         <data>Little Rock</data>
                  </item>
        </obj>

Step two;
copy and paste this code into flex builder
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute">              
        <mx:XML id="xmlData" source="myData.xml" format="e4x" />
        
        <mx:Panel layout="absolute" title="States" left="5" top="5" 
bottom="5" right="5">
                <mx:ComboBox dataProvider="{xmlData.item.label}"  
left="5" top="20"/>
                <mx:ComboBox dataProvider="{xmlData.item.data}" 
left="150" top="20" />  
        </mx:Panel>             
</mx:Application>

The file myData.xml is used to populate the combo boxes


>From one newbie to another.

Hope this helps

Eric

--- In flexcoders@yahoogroups.com, "John Mazzocchi" 
<[EMAIL PROTECTED]> wrote:
>
> Hi, newbie question here ... just learning. I'm using Flex 2. 
There seem to be numerous errors and typos in the Adobe Flex Help 
files/PDFs and I'm hitting a snag here ...
> 
> What I'd like to do, to begin with, is to populate a ComboBox from 
an external XML file. The section in the help files 
called "Populating a ComboBox control using variables and models" 
seems pertinent, but the second part of example doesn't work.
> 
> The relevant code is this ...
> 
> <mx:Model id="myDP">
>         <obj>
>             <item label="AL" data="Montgomery"/>
>             <item>
>                 <label>AK</label>
>                 <data>Juneau</data>
>             </item>
>             <item>
>                 <label>AR</label>
>                 <data>Little Rock</data>
>             </item>
>         </obj>
> </mx:Model>
>       
> <mx:ArrayCollection id="stateAC" source="{myDP.obj.item}"/>
> 
> <mx:ComboBox dataProvider="{stateAC}"/>
> 
> Should I be using XML or XMLList instead? Later I'd like to have 
the dataProvider be from an external source (HTTPService or 
WebService), but I can't even get this simpler code to work. Any 
help appreciated. Thanks.
> 
> 
> This email and any files transmitted with it may be confidential 
and are intended solely for the use of the individual or entity to 
whom they are addressed. This email may contain personal information 
of individuals, and be subject to Commonwealth and/or State privacy 
laws in Australia. This email is also subject to copyright. If you 
are not the intended recipient, you must not read, print, store, 
copy, forward or use this email for any reason, in accordance with 
privacy and copyright laws. If you have received this email in 
error, please notify the sender by return email, and delete this 
email from your inbox.
>








--

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



 






------------------------ Yahoo! Groups Sponsor --------------------~--> 
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
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/

<*> 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