ZAPAnet総合情報局 > [Z]ZAPAブロ〜グ2.0 > プログラミングTIPS > flash - 勝手に移植 - ヤンキー名ジェネレータ

flash - 勝手に移植 - ヤンキー名ジェネレータ

このエントリーをはてなブックマークに追加
2008年03月21日 カテゴリ:プログラミングTIPS
ギークなお姉さんもPHPも好きだけど、ActionScript3.0も好きなので。
Flash

こんなものでいかが?



以下、ソース。

ソースは、「404 Blog Not Found:perl+javascript - 勝手に移植 - ヤンキー名ジェネレータ」を参考に、改良された「ぱぴぷぺぽ」の部分を勝手にreverse engineerして移植しました。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
     width="450" height="150" backgroundGradientAlphas="[1.0, 1.0]"
     backgroundGradientColors="[#FFFFFF, #C9DAFF]">
    <mx:Label x="0" y="0" text="ひらがなで入力してね!" fontSize="12"/>
    <mx:Label x="0" y="30" text="お名前:" fontSize="14"/>
    <mx:TextInput x="55" y="30" id="ti0" editable="true" change="yankeeReplace()"
         imeMode="JAPANESE_HIRAGANA" width="390" fontSize="14"/>
    <mx:Text x="0" y="70" id="text0" fontSize="24" fontWeight="bold"
         color="#C01030" width="100%"/>
    <mx:Script>
        <![CDATA[
            public function yankeeReplace():void{
                var y:Array = ["ぁ","愛","ぃ","威","ぅ","宇","ぇ","江","ぉ","悪",
                               "華","餓","鬼","義","苦","愚","毛","外","虎","悟",
                               "鎖","座","刺","痔","棲","頭","世","是","甦","族",
                               "多","堕","痴","滋","ッ","津","図","手","出","斗","怒",
                               "那","弐","濡","音","乃","覇",
                               "罵","ぱ","悲","美","ピ","腐","武","風","屁",
                               "便","( ゚д゚) 、ペッ","惚","慕","峰",
                               "魔","魅","無","芽","喪","矢","嫌","癒","遊","ョ","夜",
                               "羅","離","流","麗","露","ゎ","我","ゐ","ゑ","ヲ","無"];
                text0.text = "";
                for (var i:int = 0; i < ti0.length; i++) {
                    if( ti0.text.charAt(i).match(/[ぁ-ん]/) != null ){
                        text0.text += y[ti0.text.charCodeAt(i) - "ぁ".charCodeAt(0)];                        
                    }else{
                        text0.text += ti0.text.charAt(i);
                    }
                }
            }
        ]]>
    </mx:Script>
</mx:Application>

威痔ョ宇夜露刺苦!
座ぱ夜離