NabeAtzz4 - forked from: NabeAtzz3
NabeAtzz logic from http://d.hatena.ne.jp/nacookan/20080418/1208502134
要 Flash Player 10
// forked from nacookan's NabeAtzz3 - forked from: NabeAtzz2
// 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
// 要 Flash Player 10
package{
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import flash.events.*;
import caurina.transitions.Tweener;
[SWF(backgroundColor="0x000000", frameRate="30")]
public class NabeAtzz4 extends Sprite{
public function NabeAtzz4():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(150, 0);
timer.addEventListener(TimerEvent.TIMER, function():void{
if(200 <= num) timer.stop();
var f:TextFormat = new TextFormat();
f.align = TextFormatAlign.JUSTIFY;
f.font = 'Arial';
f.bold = true;
f.size = 9;
f.color = 0xe0e0e0;
var t:TextField = new TextField();
t.defaultTextFormat = f;
t.text = (Object(num).has_num(3)) ? Object(num).to_aho() : num.toString();;
t.autoSize = TextFieldAutoSize.LEFT;
t.antiAliasType = AntiAliasType.ADVANCED;
t.selectable = false;
t.x = 0;
t.y = 0;
var m:Sprite = new Sprite();
m.x = 50 + Math.random() * 200;
m.y = Math.random() * 300;
m.scaleX = 30;
m.scaleY = 30;
m.rotationZ = Math.random() * 360;
m.rotationX = Math.random() * 360;
m.addChild(t);
stage.addChild(m);
Tweener.addTween(m, {
x: 50 + Math.random() * 300,
y: Math.random() * 400,
rotationZ: Math.random() * 360,
rotationX: 0,
scaleX: 1,
scaleY: 1,
time: 1,
transition: 'easeOutExpo'
});
num++;
});
timer.start();
}
}
}