Learning Flex 3を読んだよ(^−^)+小ネタ

Learning Flex 3: Getting Up to Speed With Rich Internet Applications (Adobe Developer Library)

Learning Flex 3: Getting Up to Speed With Rich Internet Applications (Adobe Developer Library)


読んだので感想でっす。
こちらの本は初心者向けで分かりやすいです。
図が多めに掲載されてたり、コードに色がつけられたりと読んでても疲れにくいです。
内容は、Flexのコンポーネントというよりも、中身についていろいろ書かれています。バイディングや state の説明があって、その辺のことを知らない方は買ってもいいかなって思います。
ただ、今回はページ数もそんなに多くなく、さわり的な紹介ばかりなのが残念。

本を読んでちょっと作ってみたもの。
http://moeten.info/flex/20080712_learningFlex/bin-release/main.html

#カレンダーはカスタムされたものを使ってます。年齢の入力なので年の指定が簡単にできるほうがいいと思うので。
小ネタ

文字の入力制限

<mx:TextInput restrict="a-z"/>

お金のフォーマット

<mx:CurrencyFormatter id="priceFormatter"/>
<mx:TextInput text="{priceFormatter.format(10243)}" width="157"/>

年齢の計算

private function calculateAge():void{
    var birthDate:Date = birthdayDateField.selected;
    var today:Date   = new Date();
    var ageDate:Date = new Date( today.time - birthDate.time );
    var age:Number   = ageDate.fullYear - 1970;
    myOld.text = "" + numberFormatter.format(age) + " 歳だよ";
}

読み込み中にバーを表示

<mx:ProgressBar id="myBar" width="102" visible="false" source="{myImage}"/>
<mx:Image id="myImage" width="48" height="46" source="img/31.jpg"
    open="myBar.visible=true" complete="myBar.visible=false"/>

マウスオーバーで文字をフェード

<mx:Label text="マウスオーバーでフェード" rollOverEffect="myDissolve"/>
<mx:Dissolve id="myDissolve" color="0xffffff"/>