<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" width="420" height="200" creationComplete="complete()" viewSourceURL="srcview/index.html"> <fx:Script> <![CDATA[ import services.BasketballService; private var basketballService:BasketballService = new BasketballService(); private function complete():void { getTeams.token = basketballService.getAllTeams(); } private function teamChangeHandler():void { if (teamList.selectedIndex != -1) { getPlayers.token = basketballService.getPlayersByTeam(teamList.selectedItem); } } ]]> </fx:Script> <fx:Declarations> <s:CallResponder id="getTeams" /> <s:CallResponder id="getPlayers" /> </fx:Declarations> <fx:Style> @namespace s "library://ns.adobe.com/flex/spark"; s|List { fontSize: 20; fontFamily: Times; } </fx:Style> <s:HGroup left="5" right="5" top="5" bottom="5" gap="10"> <s:List id="teamList" width="200" height="190" dataProvider="{getTeams.lastResult}" change="teamChangeHandler()" /> <s:List id="playerList" width="200" height="190" dataProvider="{getPlayers.lastResult}" /> </s:HGroup> </s:Application>