文字のテスト
/**
* Copyright nacookan ( http://wonderfl.net/user/nacookan )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/l2PT
*/
package {
import flash.display.*;
import flash.text.*;
import com.flashdynamix.motion.Tweensy;
import fl.motion.easing.*;
public class FlashTest extends Sprite {
public function FlashTest() {
var format:TextFormat = new TextFormat();
format.font = 'Century Gothic';
format.size = 20;
var text:TextField = new TextField();
text.defaultTextFormat = format;
text.text = 'hello world!';
text.autoSize = TextFieldAutoSize.LEFT;
var bmpd:BitmapData = new BitmapData(text.textWidth, text.textHeight, true, 0xffffffff);
bmpd.draw(text);
//addChild(new Bitmap(bmpd));
var s:Number = 4;
for(var xx:Number = 0; xx < bmpd.width; xx++){
for(var yy:Number = 0; yy < bmpd.height; yy++){
if(bmpd.getPixel(xx, yy) == 0xffffff) continue;
var sp:Sprite = new Sprite();
sp.graphics.beginFill(0xff0000);
sp.graphics.drawCircle(0, 0, s / 2);
sp.graphics.endFill();
sp.x = Math.random() * 400;
sp.y = Math.random() * 400;
sp.z = Math.random() * 1000;
addChild(sp);
Tweensy.to(sp, {x: xx * s, y: yy * s + 100, z: 0}, 5, Sine.easeOut);
}
}
}
private var traceText:TextField;
private function t(message:Object):void {
if(traceText == null) {
var format:TextFormat = new TextFormat();
format.font = 'Century Gothic';
format.size = 10;
traceText = new TextField();
traceText.defaultTextFormat = format;
traceText.autoSize = TextFieldAutoSize.LEFT;
addChild(traceText);
}
traceText.appendText(message.toString());
}
}
}