[練習]Bitmapで文字
forked from package土台用 (diff: 64)
ActionScript3 source code
/**
* Copyright Tamanegi_kenshi ( http://wonderfl.net/user/Tamanegi_kenshi )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/bh4A
*/
// forked from Tamanegi_kenshi's package最初
package {
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
import caurina.transitions.Tweener;
public class FlashTest extends Sprite {
private var ballArr:Array=new Array();
private var tf:TextField;
private var bd:BitmapData;
public function FlashTest() {
init();
}//FrashTest
private function init():void{
tf=new TextField();
tf.textColor=0xff0000;
tf.autoSize="left";
tf.text="おぎ\nやはぎ";
bd=new BitmapData(tf.width,tf.height,false,0x000000);
bd.draw(tf);
for(var i:int=0;i<bd.width;i++){
for(var j:int=0;j<bd.height;j++){
var ball:Ball=new Ball(bd.getPixel(i,j));
ball.x=Math.random()*300;
ball.y=Math.random()*300;
ball.alpha=0;
addChild(ball);
ballArr.push(ball);
ball.addEventListener(MouseEvent.ROLL_OVER,onRoll);
Tweener.addTween(ball,{x:i*5,y:j*5,alpha:1,delay:Math.random()*10/2,time:1});
}//for j
}//for i
stage.addEventListener(MouseEvent.CLICK,onOver);
}//init
private function onOver(event:MouseEvent):void{
}//onOver
private function onRoll(event:MouseEvent):void{
event.target.addEventListener(Event.ENTER_FRAME,onEnter);
}//onRoll
private function onEnter(event:Event):void{
event.target.x+=5;
}//onEnter
}//class
}//package
import flash.display.Sprite;
class Ball extends Sprite{
function Ball(color:Number){
graphics.beginFill(color);
graphics.drawCircle(0,0,3);
graphics.endFill();
}//Ball
}//class
