In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

NabeAtzz3 - forked from: NabeAtzz2

NabeAtzz logic from http://d.hatena.ne.jp/nacookan/20080418/1208502134
Get Adobe Flash player
by nacookan 23 Dec 2008
// forked from nacookan's NabeAtzz2 - forked from: NabeAtzz
// forked from nacookan's NabeAtzz - forked from: FizzBuzz2
// forked from nacookan's FizzBuzz2
// NabeAtzz logic from http://d.hatena.ne.jp/nacookan/20080418/1208502134
package{
    import flash.display.*;
    import flash.text.*;
    import flash.utils.*;
    import flash.events.*;
    import caurina.transitions.Tweener;

    [SWF(backgroundColor="0xf0f0f0", frameRate="30")]

    public class NabeAtzz3 extends Sprite{
        public function NabeAtzz3():void{
            Number.prototype.has_num = function(n:Number):Boolean{
                if(this == 0) return false;
                if(this % n == 0) return true;
                return (function(a:Number, b:Number):Boolean{
                    if(a == 0) return false;
                    if(a % 10 == b) return true;
                    return arguments.callee(Math.floor(a / 10), b);
                })(this, n);
            };
            Number.prototype.to_aho = function():String{
                var ahonums:Array = [
                    ['', 'いち', 'に', 'さぁん', 'し', 'ご', 'ろく', 'しち', 'はち', 'きゅう'],
                    ['', 'じゅう', 'にーじゅ', 'さぁんじゅ', 'よぉんじゅ', 'ごぉじゅ', 'ろくじゅ', 'ななじゅ', 'はちじゅ', 'きゅうじゅ'],
                    ['', 'ひゃく', 'にひゃく', 'さんびゃく', 'よんひゃく', 'ごひゃく', 'ろっぴゃく', 'ななひゃく', 'はっぴゃく', 'きゅうひゃく'],
                    ['', 'せん', 'にせん', 'さんぜん', 'よんせん', 'ごせん', 'ろくせん', 'ななせん', 'はっせん', 'きゅうせん'],
                    ['', 'いちまん', 'にまん', 'さんまん', 'よんまん', 'ごまん', 'ろくまん', 'ななまん', 'はちまん', 'きゅうまん']
                ];
                var r:Array = [];
                var s:String = this.toString();
                if(ahonums.length < s.length) return s;
                for(var i:Number = 0; i < s.length; i++){
                    var d:Number = Number(s.charAt(s.length - 1 - i));
                    r.unshift(ahonums[i][d]);
                }
                return r.join('');
            };

            var num:Number = 1;
            var stage:Sprite = this;
            var timer:Timer = new Timer(300, 0);
            timer.addEventListener(TimerEvent.TIMER, function():void{
                if(300 <= num) timer.stop();
                var t:TextField = new TextField();
                t.text = (Object(num).has_num(3)) ? Object(num).to_aho() : num.toString();;
                t.autoSize = TextFieldAutoSize.LEFT;
                t.selectable = false;
                t.x = 0;
                t.y = 0;
                var m:Sprite = new Sprite();
                m.x = Math.random() * 200;
                m.y = Math.random() * 300;
                m.scaleX = 20;
                m.scaleY = 20;
                m.addChild(t);
                stage.addChild(m);
                Tweener.addTween(m, {
                    x: Math.random() * 300,
                    y: Math.random() * 400,
                    scaleX: 1,
                    scaleY: 1,
                    time: 1,
                    transition: 'easeOutExpo'
                });
                num++;
            });
            timer.start();
        }
    }
}