Flex changes in a Spark DropDownList
new flex, , need advice. see following code got blog:
<?xml version="1.0"?>
<s:application name="spark_dropdownlist_change_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:script>
<![cdata[
import spark.events.indexchangeevent;
protected function dropdownlist_changehandler(evt:indexchangeevent):void {
lbl.text = "you selected " + dropdownlist.selecteditem.team;
}
]]>
</fx:script>
<fx:declarations>
<s:arraylist id="arrlist">
<fx:object team="los angeles" name="angels of anaheim" />
<fx:object team="seattle" name="mariners" />
<fx:object team="oakland" name="athletics" />
<fx:object team="texas" name="rangers" />
<fx:object team="cleveland" name="indians" />
<fx:object team="detroit" name="tigers" />
<fx:object team="minnesota" name="twins" />
<fx:object team="chicago" name="white sox" />
<fx:object team="kansas city" name="royals" />
<fx:object team="boston" name="red sox" />
<fx:object team="new york" name="yankees" />
<fx:object team="toronto" name="blue jays" />
<fx:object team="baltimore" name="orioles" />
<fx:object team="tampa bay" name="rays" />
<fx:object team="arizona" name="diamondbacks" />
<fx:object team="colorado" name="rockies" />
<fx:object team="san diego" name="padres" />
<fx:object team="los angeles" name="dodgers" />
<fx:object team="san francisco" name="giants" />
<fx:object team="chicago" name="cubs" />
<fx:object team="milwaukee" name="brewers" />
<fx:object team="st. louis" name="cardinals" />
<fx:object team="houston" name="astros" />
<fx:object team="cincinnati" name="reds" />
<fx:object team="pittsburgh" name="pirates" />
<fx:object team="philadelphia" name="phillies" />
<fx:object team="new york" name="mets" />
<fx:object team="atlanta" name="braves" />
<fx:object team="washington" name="nationals" />
<fx:object team="florida" name="marlins" />
</s:arraylist>
</fx:declarations>
<s:vgroup horizontalcenter="0" top="10">
<s:dropdownlist id="dropdownlist"
dataprovider="{arrlist}"
labelfield="team"
prompt="please select team..."
change="dropdownlist_changehandler(event);" />
<s:label id="lbl" />
</s:vgroup>
</s:application>
what i`m trying data xml file, , difference selected lable`s show details example:
i have 2 people in xml:
<job>
<clientname>first names</clientname>
<clientsurname>surnames</clientsurname>
<clientmobile>123456789</clientmobile>
<clientalternative>987654321</clientalternative>
<datebooked>thu aug 23 00:00:00 gmt+0200 2012</datebooked>
<daterequired>fri aug 31 00:00:00 gmt+0200 2012</daterequired>
<numitems>1</numitems>
<itemtype>pc box only</itemtype>
<clientcomments>wont power up
problem loading windows</clientcomments>
<clientrequirements>format , re-install
backup document</clientrequirements>
<itemlable>ww01</itemlable>
<itemnotes>damage on front panel
damage on panel</itemnotes>
</job>
where "dropdownlist" selected first person, details appear in "lable" field (see code above).
help! :-)
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment