MACROMEDIA FLEX-GETTING STARTED WITH FLEX Bedienungsanleitung Seite 42

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 148
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 41
Figure 3-6. The Button component in the Outline view
2. To
the Button component, add a click attribute with a
value of requestPhotos():
<mx:Button label="Search" click="requestPhotos()"/>
When a user clicks the button, it calls the requestPho
tos() handler, which initiates the HTTPService call.
3. Using the Outline view, locate the TextInput component
in the HBox component and add an id attribute with a
value of searchTerms. The instance name for the TextIn
put component is id, as shown here:
<mx:TextInput id="searchTerms"/>
4. In the mx:Script block, create a private function named
requestPhotos() with a return value of *void. This is the
function where the HTTPService call is initiated.
The relevant code appears in Example 3-7.
Example 3-7. The requestPhotos method
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var photoFeed:ArrayCollection;
private function requestPhotos():void{
}
]]>
</mx:Script>
26 | Chapter 3:Flex 101: Step by Step
Seitenansicht 41
1 2 ... 37 38 39 40 41 42 43 44 45 46 47 ... 147 148

Kommentare zu diesen Handbüchern

Keine Kommentare