初音ミクあいうえおAPI

初音ミクFlexからしゃべらせてみようってことで、作ってみました。
ソースを見ると分かると思うけど単純に入力された言葉を元にファイルを再生しているだけでっす。
http://moeten.info/hatena/20071105_MikuAPI/bin/main.html

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="600" height="600" creationComplete="initApp();" backgroundGradientColors="[#ffffff, #ffffff]"      viewSourceURL="srcview/index.html">
<mx:Script>
    <![CDATA[
        import mx.containers.Tile;
        private var voice:Array = new Array(
                                            "あ","い","う","え","お",
                                            "か","き","く","け","こ",
                                            "さ","し","す","せ","そ",
                                            "た","ち","つ","て","と",
                                            "な","に","ぬ","ね","の",
                                            "は","ひ","ふ","へ","ほ",
                                            "ま","み","む","め","も",
                                            "や","ゆ","よ",
                                            "ら","り","る","れ","ろ",
                                            "わ","を","ん"
                                            );
        // ボタンをクリックしたときに再生
        public var chari:int = 0;
        private function initApp():void{
            img1.visible = true;
            img2.visible = false;
        }
        private function onClick(e:MouseEvent):void {
            chari = 0;
            playsound();
        }
        public var timer:Timer;
        private function playsound():void{
            timer = new Timer(280,input.text.length);
            timer.addEventListener("timer", timerHandler);
            timer.start();
        }
        public var cnt:int = 1;
        public function timerHandler(event:TimerEvent):void {
            var j:int = 0;
            var file:String = new String();
            for( var i:int = 0 ; i < voice.length ; i ++ ){
                if( voice[i] === input.text.charAt(chari) ){
                    j = i+1;
                    log.text += i + ",";
                    if( j < 10 ){
                        file = "waveout/hiragana-00"+j+".mp3"
                    }else{
                        file = "waveout/hiragana-0"+j+".mp3"
                    }
                    var snd:Sound = new Sound(new URLRequest(file));
                       snd.play();
                }
            }
            chari ++;
            if( cnt % 2 == 1 ){
                img1.visible = false;
                img2.visible = true;
            }else{
                img2.visible = false;
                img1.visible = true;
            }
            cnt++;
            if( chari == input.text.length ){
                timer.stop();
            }
        }
    ]]>
</mx:Script>
<mx:Button x="31" y="66" label="再生" click="onClick(event)"/>
    <mx:Image x="87" y="-36" source="01.jpg" id="img1"/>
    <mx:Image x="87" y="-36" source="02.jpg" id="img2"/>
    <mx:TextInput x="31" y="36" id="input" text="おかえりなさいませ"/>
    <mx:Text x="31" y="128" text="ログ"/>
    <mx:Text x="31" y="10" text="入力(あ〜ん)"/>
    <mx:TextArea x="31" y="154" height="129" id="log"/>
</mx:Application>