I would expect you would set it up something like this:

 

<mx:ComboBox id="appName" styleName="glass" width="161"
change="dispatchFilter();">
<mx:dataProvider>
<mx:Array>
<mx:Object label="All" url="http://a.b.com/somehttpservice?filter=all";
/>
<mx:Object label="Cellular Mobile"
url="http://a.b.com/somehttpservice?filter=cellularmobile"; />

...
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>



private function dispatchFilter():void

{

    trace(appName.selectedItem.url); // use this url to fetch the XML

}

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of danj520
Sent: Sunday, March 18, 2007 11:02 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: ComboBox & URLs

 

I tried this, but I'm not sure it will work as you suggested. Here's
what I have for populating the ComboBox and the change event. 

<mx:ComboBox id="appName" styleName="glass" width="161"
change="dispatchFilter();">
<mx:dataProvider>
<mx:Array>
<mx:String>All</mx:String>
<mx:String>Cellular Mobile</mx:String>
<mx:String>12.5V HF SSB</mx:String>
<mx:String>28V HF SSB</mx:String>
<mx:String>50V HF SSB</mx:String>
<mx:String>Cellular Base Station</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>

private function dispatchFilter():void
{
var event:ProductFilterEvent = 
new ProductFilterEvent(filter, thumbBeingPressed);
dispatchEvent(event);
currentState = "showingThumbnails";
}
If I choose any option, the dispatchFilter function will filter the
data based on the option criteria, and it's not what I want, what I
want is the URL defined for the HTTPService so I can load a new XML
file on the fly. What I think I need is a different "change=" function
to do that. Hopefully, this is not too confusing. Thank you again
kindly for your time. 

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Assuming you know the mapping of combobox items to URLs, you can
> populate the array as follows:
> 
> 
> 
> <mx:Array>
> 
> <mx:Object label="choice 1" url="http://a.b.com/url1
<http://a.b.com/url1> " />
> 
> <mx:Object label="choice 2" url="http://a.b.com/url2
<http://a.b.com/url2> " />
> 
> <mx:Object label="choice 3" url="http://a.b.com/url3
<http://a.b.com/url3> " />
> 
> </mx:Array
> 
> 
> 
> The combo box will display "choice 1", "choice 2", or "choice3". When
> an option is selected, selectedItem.url is the url.
> 
> 
> 
> -Alex
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of danj520
> Sent: Sunday, March 18, 2007 10:05 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] ComboBox & URLs
> 
> 
> 
> I hope someone can help. I have a ComboBox that has a list of options.
> When an option is selected, I would like a corresponding XML file to
> be loaded. I assume I have to declare a string variable to assign the
> URL. The ComboBox dataProvider is hard-coded with an <mx:Array>, but
> I'm stuck on how to assign the URL from the option selected. I
> appreciate any help I can get. I'm familiar with how to load the data
> with HTTPService. Thanks in advance...
>

 

Reply via email to