Flex4入門[1日目]

CS5についてきた「Flash Builder」を使いこなすべく、今日から勉強をしていきます。

Adobe Flash Builder Standard 4.0 日本語版 Windows/Macintosh版
Adobe Flash Builder Standard 4.0 日本語版 Windows/Macintosh版

まずは買った本

Flex 3.4プログラミング入門
Flex 3.4プログラミング入門

ビューステート

[cc lang="xml"] <?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/mx" minWidth="955" minHeight="600">

<s:states>
    <s:State name="logout"/>
    <s:State name="login" enterState="tal.text+='ログインしました\n'" exitState="tal.text+='ログアウトしました\n'"/>
</s:states>

<s:HGroup>
    <s:Label text="ログイン中" color="#0000ff" visible="false" visible.login="true"/>
    <s:TextArea id="tal" height="300" width="200" width.login="333" height.login="40"/>

    <s:Button id="login_btn"
              label.logout="ログインしてください"
              label.login="ログアウトします"
              click.logout="currentState='login';login_btn.label='ログオフします'"
              click.login="currentState='logout';login_btn.label='ログインします'"/>
    </s:HGroup>

<fx:Declarations>
    <!-- 非ビジュアルエレメント (サービス、値オブジェクトなど) をここに配置 -->
</fx:Declarations>

</s:Application> [/cc]

エフェクト

ターゲットが複数の場合は、targetではなくtargetsにする。 ターゲットの中身も配列で指定する。[targetA,targetB,targetC]のように [cc lang="xml"] <?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/mx" minWidth="768" minHeight="400" xmlns:local="*">

<s:layout>
    <s:VerticalLayout/>
</s:layout>

<fx:Declarations>
  <s:Resize id="myResize"
            heightBy="25"
            widthBy="20"
            targets="{[botton1,botton2,botton3]}"/>

</fx:Declarations>


<s:Button id="botton1" label="button" />
<s:Button id="botton2" label="button" />
<s:Button id="botton3" label="button" />
<s:Button id="botton4"
          label="大きくする"
          click="myResize.end(); myResize.play();"/>

</s:Application> [/cc]

主なエフェクトプロパティ
  • duration:エフェクトの時間を指定。1000で一秒
  • repeatCount:エフェクトの回数。デフォルトは1。0だと無限に繰り返します

[cc lang="xml"] <s:layout> <s:VerticalLayout/> </s:layout> [/cc] レイアウトは

    BasicLayout
  • HorizontalLayout
  • VerticalLayout

レイアウトについてはこちらを参照した。

主なエフェクトイベント

  • effectEnd イベントが終了したときに指定されたイベントを実行します。