An example that uses the Yahoo! Weather API to retrieve weather information. The location and unit to use are sent via flash vars (added to the html). When running your project, you need to add this flash var to your html template: location=your_location (replace your_location).
While this example is simple, it shows two important features:
- how to use the PropertyInjector and
- how to extend Mate by adding a tag that handles results and fault returned by the weather service. We have an in-depth tutorial about this example and topic.
I'm curious to know..., do you have any suggestions on how to use this sample widget / example without using FlashVars? I guess I'm looking for a code example on how to change the weather data based on an zip code selected in a Flex 3 list box.
Thanks!
Doing that should be pretty simple, since the main code is implemented in the WeatherEvent.GET EventHandlers. It would be a matter of dispatching the WeatherEvent.GET event with the location you get from your list. Something like this in your view:
var event:WeatherEvent = new WeatherEvent(WeatherEvent.GET, true);
event.location = myList.selectedItem (or something like this)
dispatchEvent(event);
(You might also need to set the unit property in the event, which I think is either f or c)
Ryan
The reason for that was to make the view as simple as possible, and have any formatting of data done in a different place.
unit is not there because it uses the default. If you want to change it, simply add it after the location with &unit=YOUR_UNIT
A city name ? or any code for the city?
Because when I pass let's say "Ahmedabad"
It shows nothing..
but instead if I pass
"..?location=INXX0001&unit=c"
it shows correct result...
so how can I get the code related to city / location ?
Or am I missing something ?
or should I elaborate more ?
What you need to pass is what Yahoo!'s API will accept as is. For US, zip codes work, but for other countries you may need to pass the specific code. You'd need to check Yahoo's page to see how to get the code.
Well there is one more query that why do we need extensions ?
Means are there only to handle the events processes executed by IActionList in our own way?
And if so then y do we need to extend the MATE ?
Can't we do something else ?
Otherwise plz explain the Extensions basic usage in brief.