Creating a Fifa 2010 Country Selector In Flash Lite
getDataProvider() Â Utility Function:
{
var dp:Array = new Array();
for(var key in countryList)
dp.push(key);
return dp;
}
Explanation: The Sony Ericsson’s ListSingleRow component requires a simple array as a data provider which is assigned to its “_text” property. Hence we need to create a simple array or strings from our countryList object keys (Country codes). So the above utility function does just that. It collects the key param of all the objects in the array countryList and returns it as a array.
onCountrySelect() Â Event Handler Function:
function onCountrySelect(sender:MovieClip, label:String, position:Number)
{
var countryData = countryList[label];
//---------------------------------
trace("Fifa Code :"+label);
trace("Country :"+countryData.country);
trace("ISO Code :"+countryData.isocode);
trace("Group :"+countryData.group);
}
Explanation: The above function is the event handler for the visual list component. Thus when use presses the “Enter” key on the device to confirm selection, the onCountrySelect function triggers, passing through the reference of the list component, the selected  label and its index. As you see we can then use the “label”, which happens to be the key param in our lookup table, to fetch the appropriate country object and display its details.
Output:
Download : Fla (Flash Lite  list demo)
Popularity: 30% [?]
May 27, 2010
Tags: Actionscript 2.0, Flash Lite, Mobile Posted in: Actionscript 2.0, Flash Lite, Mobile, Sony Ericsson





Leave a Reply