MACROMEDIA FLEX-GETTING STARTED WITH FLEX Manuel d'utilisateur Page 40

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 148
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 39
dler(event). The photoHandler event packages the serv-
ice results. We will create the {{photoHandler}} function
later.
Example 3-2 shows the relevant code.
Example 3-2. The HTTPService control
<mx:HTTPService id="photoService"
url="http://api.flickr.com/services/feeds
/photos_public.gne"
result="photoHandler(event)"/>
Now it’s time to create a bindable XML variable in ActionScript
3.0. To do so, follow these steps:
1. Before the HTTPService component, add a Script com-
ponent by typing <mx:Script>. Flex Builder completes
the tag for you. Alternatively, you can place the Script
component after the HTTPService component, as shown
in Example 3-3.
Example 3-3. The blank script tag
<mx:Script>
<![CDATA[
]]>
</mx:Script>
2. In the mx:Script block, enter
import mx.collections.ArrayCollection. ArrayCollec
tion is the type of object that is used as a data provider.
The relevant code is shown in Example 3-4.
Example 3-4. The first import statement
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
]]>
</mx:Script>
3. After the ArrayCollection import statement, enter
import mx.rpc.events.ResultEvent to import the Resul
tEvent class. The ResultEvent class is the type of event
24 | Chapter 3:Flex 101: Step by Step
Vue de la page 39
1 2 ... 35 36 37 38 39 40 41 42 43 44 45 ... 147 148

Commentaires sur ces manuels

Pas de commentaire