forked from: forked from: forked from: forked from: forked from: flash on 2010-1-13
forked from 【練習】クラスの練習 (diff: 93)
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/iHHU
*/
package{
import flash.text.TextField;
import flash.utils.Timer;
import flash.display.Sprite;
import flash.events.TimerEvent;
import flash.text.TextFormat;
import flash.filters.BlurFilter;
import flash.filters.DropShadowFilter;
import flash.events.Event;
public class test extends Sprite{
private var _text:String;
private var mytext:TextField;
private var mytimer:Timer;
private var count:int=0;
private var _format:TextFormat;
public function test(){
init();
}
private function init():void{
_text="今日の天気はないしょ!";
mytext =new TextField();
mytext.width=500;
mytext.height=100;
_format=new TextFormat();
_format.size=50;
_format.font="_ゴシック";
_format.color=0x000000;
mytext.defaultTextFormat=_format;
addChild(mytext);
var blur:BlurFilter=new BlurFilter(0,0,5);
var myfilter:Array=new Array();
myfilter.push(blur);
var drop:DropShadowFilter=new DropShadowFilter(5,50,0xff0000,1,10);
myfilter.push(drop);
mytext.filters=myfilter;
mytimer =new Timer(1000);
mytimer.addEventListener(TimerEvent.TIMER,on);
mytimer.start();
}
private function on(event:TimerEvent):void{
mytext.appendText(_text.charAt(count));
count++;
if(count ==_text.length+1){
mytimer.stop();
addEventListener(Event.ENTER_FRAME,one);
if(mytext.alpha==0){
mytext.visible =false;
}
}
}
private function one(event:Event):void{
mytext.alpha -=0.05;
}
}
}
