forked from: AngelBeatsの次回予告的なものをつくってみた
texts from http://jsdo.it/mumoshu/2Ac6
/**
* Copyright civet ( http://wonderfl.net/user/civet )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/z7B7
*/
// forked from 7kamura's AngelBeatsの次回予告的なものをつくってみた
// texts from http://jsdo.it/mumoshu/2Ac6
package
{
import flash.display.*;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.utils.Timer;
import flash.filters.*;
import flash.events.TimerEvent;
import flash.events.Event;
import flash.system.*;
import flash.net.*;
import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();
[SWF(width=465, height=465, frameRate=30, backgroundColor=0xffffff)]
public class TweenerSample extends Sprite
{
public var timer:Timer = new Timer(800);
public var texts:Array;
public var textLoader:URLLoader;
public function TweenerSample() {
loadText();
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
}
public function loadText():void {
/*Security.loadPolicyFile("http://5ivestar.org/proxy/crossdomain.xml");
textLoader = new URLLoader();
textLoader.addEventListener(Event.COMPLETE, completeHandler);
textLoader.load(new URLRequest("http://5ivestar.org/proxy/http://r7kamura.038shi.lucian.hostingrails.com/ed5-1.txt"));
*/
texts = [
"Knockin' ,on ,heaven's , door",
"神様も,びっくり仰天",
"戦いが・・・,終わる,のか・・・",
"消えろっ!",
"トイレット,ペーパーの,ように惨めに消えろ!",
"このまま,いなくな,っても、,誰も気づかなそう,だからなぁ!",
"俺動くのゆりっぺ,がくはの助けになる,ときだけだ!",
"百人・・・、増えた,戦力がと思え",
"次もバンド,やるよ!",
"よく辿り着けましたね",
"手を伸ばせ!",
"ここから,消えたら、,・・・やり直せ,ますかね"
];
}
/*
public function completeHandler(event:Event):void {
texts = textLoader.data.split("\n");
texts.pop();
}*/
private function onTimer(e:TimerEvent):void
{
makeText();
}
public function makeText():void
{
var fld:TextField = new TextField();
var tsize:Number = 10+Math.random()*30;
var tf:TextFormat = new TextFormat("MS ゴシック", tsize, 0x000000);
var ctf:TextFormat = new TextFormat("MS ゴシック", tsize*0.6, 0x000000);
var index:Number = timer.currentCount % texts.length;
var message:String = texts[index].replace(/\,/g, "\n");
fld.defaultTextFormat = tf;
fld.autoSize = TextFieldAutoSize.LEFT;
fld.text = "[c" + index + "]\n" + message;
fld.setTextFormat(ctf, -1, fld.text.length - message.length);
var bmd:BitmapData = new BitmapData(fld.width, fld.height, true, 0xffffff);
bmd.draw(fld);
var bmp:Bitmap = new Bitmap(bmd);
addChild(bmp);
bmp.x = Math.random()*(465 - fld.width);
bmp.y = Math.random()*(465 - fld.height);
Tweener.addTween(bmp,{
// 中心までの距離のうち4割移動して消える
x: 465/2 - (465/2 - bmp.x)*(1-0.4),
y: 465/2 - (465/2 - bmp.y)*(1-0.4),
scaleX:0.6,
scaleY:0.6,
alpha: 0,
time: 2,
transition: "easeInSine",
_Blur_blurX: 8,
_Blur_blurY: 8,
onComplete: onTweenerComplete,
onCompleteParams: [bmp]
});
}
private function onTweenerComplete(bmp:Bitmap):void
{
removeChild(bmp);
}
}
}