MACROMEDIA FLEX-GETTING STARTED WITH FLEX Instrukcja Użytkownika Strona 20

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 148
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 19
some things that are difficult to do in the browser without any
code.
Our next step will be to add some dynamic behavior to the
example by adding controls for the rotation, the sizing, and the
visibility of the image. The updated code appears in Exam-
ple 1-2.
Example 1-2. Starter.mxml updated with controls
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:HBox top="10” left="10">
<mx:HSlider minimum="−30” maximum="30” value="−10”
toolTip="Rotation”
change="myimg.rotation=event.currentTarget.value”
liveDragging="true” />
<mx:HSlider minimum="100” maximum="300” value="100”
toolTip="Size”
change="myimg.height=event.currentTarget.value”
liveDragging="true” />
<mx:CheckBox label="Visible” change="myimg.visible=
event.currentTarget.selected”
selected="true"/>
</mx:HBox>
<mx:Image id="myimg" source="@Embed('mypicture.jpg')"
height="100" top="60" left="30" rotation="−10">
<mx:filters>
<mx:DropShadowFilter />
</mx:filters>
</mx:Image>
</mx:Application>
Now we have two sliders and a checkbox. One slider controls
the rotation and the other controls the size of the image as the
user adjusts the setting. The checkbox will hide or show the
image. Figure 1-3 shows the result.
To have a little more fun with the example I’ll add some effects
that fade the image in or out when its shown or hidden. Ex-
ample 1-3 shows the updated image code.
4 | Chapter 1:Installing Flex Builder 3
Przeglądanie stron 19
1 2 ... 15 16 17 18 19 20 21 22 23 24 25 ... 147 148

Komentarze do niniejszej Instrukcji

Brak uwag