読者です 読者をやめる 読者になる 読者になる

誕生日アプリを更新

Flex

ちょっとだけ誕生日アプリを更新しましたー

こちらからダウンロードできまーっす♪
https://play.google.com/store/apps/details?id=air.happyBirthDayApp
あと、ソースコードはこちらっ
※DPIの設定とかよく分からんち

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark" actionBarVisible="false"
        xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="view1_creationCompleteHandler(event)">
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.events.FlexEvent;
            import spark.events.IndexChangeEvent;
            private var nameArr:Array = new Array(
                'abe',
                'akiyama',
                'andou',
                'aoki',
                'arai',
                'araki',
                'asano',
                'azuma',
                'baba',
                'chiba',
                'endo',
                'goto',
                'hagiwara',
                'hamada',
                'hara',
                'harada',
                'hasegawa',
                'hashimoto',
                'hattori',
                'hayakawa',
                'hayashi',
                'higuchi',
                'hirai',
                'hirano',
                'hirata',
                'hirose',
                'honda',
                'honnma',
                'hori',
                'hoshino',
                'hujii',
                'hujimoto',
                'hujita',
                'hujiwara',
                'hukuda',
                'hukui',
                'hukusima',
                'hurukawa',
                'ichikawa',
                'igarashi',
                'iida',
                'ikeda',
                'imai',
                'inoue',
                'ishibashi',
                'ishihara',
                'isida',
                'isii',
                'isikawa',
                'ito',
                'iwamoto',
                'iwasaki',
                'iwata',
                'kamata',
                'kaneko',
                'kannno',
                'katayama',
                'kato',
                'kawaguchi',
                'kawakami',
                'kawamura',
                'kawasaki',
                'kikuchi',
                'kimura',
                'kinoshita',
                'kitamura',
                'kobayashi',
                'koike',
                'kojima',
                'komatsu',
                'kondou',
                'konishi',
                'kouno',
                'koyama',
                'kubo',
                'kubota',
                'kudou',
                'kumagai',
                'kurihara',
                'kuroda',
                'kuwahara',
                'maeda',
                'maruyama',
                'masuda',
                'matsubara',
                'matsuda',
                'matsui',
                'matsumoto',
                'matsumura',
                'matsuo',
                'matsuoka',
                'matsushita',
                'matsuura',
                'minami',
                'miura',
                'miyake',
                'miyamoto',
                'miyata',
                'miyazaki',
                'mizuno',
                'mochiduki',
                'mori',
                'morimoto',
                'morita',
                'murakami',
                'murata',
                'nagai',
                'nagata',
                'naitou',
                'nakagawa',
                'nakajima',
                'nakamura',
                'nakanishi',
                'nakano',
                'nakata',
                'nakayama',
                'narita',
                'nishida',
                'nishikawa',
                'nishimura',
                'nishiyama',
                'noda',
                'noguchi',
                'nomura',
                'oda',
                'ogawa',
                'oka',
                'okada',
                'okamoto',
                'okazaki',
                'okumura',
                'ono',
                'oohashi',
                'ooishi',
                'ookubo',
                'oomori',
                'oonishi',
                'oono',
                'ooshima',
                'oota',
                'ootani',
                'ootsuka',
                'ozaki',
                'saito',
                'sakai',
                'sakamoto 1',
                'sakamoto 2',
                'sakamoto 3',
                'sakamoto',
                'sakurai',
                'sano',
                'sasaki',
                'sato',
                'sawada',
                'seki',
                'shimada',
                'shimizu',
                'shinohara',
                'sibata',
                'sudou',
                'sugawara',
                'sugimoto',
                'sugiyama',
                'suzuki',
                'taguchi',
                'takada',
                'takagi',
                'takahashi',
                'takano',
                'takayama',
                'takeda',
                'takeuchi',
                'tamura',
                'tanabe',
                'tanaka',
                'taniguchi',
                'tsuchiya',
                'tsuji',
                'uchida',
                'ueda',
                'ueno',
                'wada',
                'watabe',
                'watanabe',
                'yamada',
                'yamaguchi',
                'yamamoto',
                'yamanaka',
                'yamashita',
                'yamauchi',
                'yamazaki',
                'yano',
                'yasuda',
                'yokota',
                'yokoyama',
                'yoshida',
                'yoshikawa',
                'yoshimura',
                'yoshioka'
            );
            private var messageArr:Array = new Array(
                'birthday1',
                'birthday2',
                'birthday3',
                'birthday4',
                'birthday5'
            );
            [Bindable]private var acChar:ArrayCollection = new ArrayCollection();
            [Bindable]private var acName:ArrayCollection = new ArrayCollection();
            [Bindable]private var acMessage:ArrayCollection = new ArrayCollection();
            protected function view1_creationCompleteHandler(event:FlexEvent):void
            {
                var len:int = nameArr.length;
                for( var i:int = 0 ; i < len ; i ++ ){
                    acName.addItem({"name":nameArr[i]});
                }
                len = messageArr.length;
                for( i = 0 ; i < len ; i ++ ){
                    acMessage.addItem({"message":messageArr[i]});
                }
                len = 24;
                for( i = 0 ; i < len ; i ++ ){
                    acChar.addItem({"alphabet":String.fromCharCode(73+24+i)});
                }
                setSelectedIndex();
            }
            protected function ddlChar_changeHandler(event:IndexChangeEvent):void
            {
                var char:String = ddlChar.selectedItem.alphabet;
                for( var i:int = 0 ; i < acName.length ; i ++ ){
                    if( String(acName[i].name ).substr(0,1) == char ){
                        ddlName.selectedIndex = i;
                        setSelectedIndex();
                        break;
                    }
                }
            }
            protected function dropdownlist1_changeHandler(event:IndexChangeEvent):void
            {
                setSelectedIndex();
            }
            private var ddlNameIndex:Number = 0;
            private var ddlMessageIndex:Number = 0;
            private var ddlCharIndex:Number = 0;
            protected function setSelectedIndex():void
            {
                ddlCharIndex    = ddlChar.selectedIndex;
                ddlNameIndex    = ddlName.selectedIndex;
                ddlMessageIndex = ddlMessage.selectedIndex;
                nameSound.source    = "assets/sound/" + nameArr[ ddlNameIndex ] + ".mp3";
                messageSound.source = "assets/sound/" + messageArr[ ddlMessageIndex ] + ".mp3";
            }
            protected function btn_clickHandler(event:MouseEvent):void
            {
                if( nameSound.isPlaying || messageSound.isPlaying ){
                    nameSound.stop();
                    messageSound.stop();
                    return ;
                }
                nameSound.play([this]);
            }
        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- 非ビジュアルエレメント (サービス、値オブジェクトなど) をここに配置 -->
        <mx:SoundEffect  id="nameSound"    useDuration="false" effectEnd="{messageSound.play([this])}" startTime="100" volumeFrom="0.8" volumeTo="0.8"/>
        <mx:SoundEffect  id="messageSound" useDuration="false" startTime="600" volumeFrom="0.8" volumeTo="0.8" />
    </fx:Declarations>
    <s:Image id="bg" source="@Embed('assets/image/bg.png')" width="486" height="806" scaleX="0.658" scaleY="0.63"/>
    <s:Image id="chara" source="@Embed('assets/image/chara.png')" width="403" height="726" scaleX="0.66" scaleY="0.63" y="20" x="25"/>
    <s:Image id="nameBg" source="@Embed('assets/image/ddl_bg.png')" width="486" height="278" scaleX="0.66" scaleY="0.63" y="210"/>
    <s:HGroup width="460" height="120" y="230" x="60" gap="0">
        <s:SpinnerList id="ddlChar" dataProvider="{acChar}" labelField="alphabet" change="ddlChar_changeHandler(event)" color="0xf1149b"
                       wrapElements="true" width="30" height="100%" />
        <s:SpinnerList id="ddlName" dataProvider="{acName}" labelField="name" change="dropdownlist1_changeHandler(event)"  color="0xf1149b"
                       wrapElements="true" width="80" height="100%" />
        <s:SpinnerList id="ddlMessage" dataProvider="{acMessage}" labelField="message" change="dropdownlist1_changeHandler(event)" color="0xf1149b"
                       wrapElements="true" width="140" height="100%"    />
    </s:HGroup>
    <s:Image id="text" source="assets/image/text_sentaku.png" width="218" height="42" scaleX="0.66" scaleY="0.63" y="210" x="85"/>
    <s:Image id="btn" source="assets/image/btn.png"  click="btn_clickHandler(event)" width="131" height="118" scaleX="0.66" scaleY="0.63" y="255" x="245"/>
</s:View>