めんまへんかん!!


ちまたで話題のあの花に感化されて世の中の文字がめんま文字になればいいなーってことで作ってみました。
http://moeten.info/flex/20110613_menmaNikki/bin-release/Main.html
文字を入力してボタンを押すとめんま文字になりまっす。
あの花公式サイト
めんまフォント
1話無料放送!!

ソースはこちら

めんまフォントはひらがながOKなので漢字をヤフーの形態素解析APIを使ってひらがに変換してあげます。

<?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"
               width="380" height="504">
    <fx:Style>
    @font-face {
        src:url("assets/menma.ttf");
        fontFamily: menma;
    }
    </fx:Style>
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            import mx.rpc.events.ResultEvent;
            protected function hts_resultHandler(event:ResultEvent):void
            {
                menmaTxt.text = "";
                var len:int = hts.lastResult.ResultSet.ma_result.word_list.word.length;
                for( var i:int = 0 ; i < len ; i ++ ){
                    menmaTxt.text += "" + hts.lastResult.ResultSet.ma_result.word_list.word[i].reading;
                }
            }
            protected function button1_clickHandler(event:MouseEvent):void
            {
                hts.send({
                    sentence:txt.text
                });
            }
        ]]>
    </fx:Script>
    <fx:Declarations>
        <s:HTTPService id="hts" result="hts_resultHandler(event)" url="http://jlp.yahooapis.jp/MAService/V1/parse?appid=アプリケーションID&amp;results=ma,uniq&amp;uniq_filter=9|10&amp;"/>
    </fx:Declarations>
    <mx:VBox horizontalAlign="center" verticalGap="30" width="100%" paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
        <s:Label text="めんまへんかん!!" fontSize="36"  fontFamily="menma" color="#A71FB3"/>
        <s:TextArea id="txt" width="100%" height="118" contentBackgroundColor="#E8FCFF" text="今日も天気がいいね!" fontSize="23" color="#1B3ED5"/>
        <s:Button label="へんかん!!"  fontFamily="menma" width="217" height="58" fontSize="27" chromeColor="#8594E0" click="button1_clickHandler(event)" x="81"/>
        <s:TextArea id="menmaTxt" fontFamily="menma" fontSize="23" color="#FF4F4F" borderVisible="false" editable="true" enabled="true" width="100%" height="166" contentBackgroundColor="#FFECEC"/>
    </mx:VBox>
</s:Application>

ヤフーのアプリケーションIDが必要でっす。