Tweener + TextShortcuts
//////////////////////////////////////////////////////////////////////////////
Tweener + TextShortcuts
//////////////////////////////////////////////////////////////////////////////
/**
* Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/rQ9w
*/
////////////////////////////////////////////////////////////////////////////////
// Tweener + TextShortcuts
////////////////////////////////////////////////////////////////////////////////
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.AntiAliasType;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.filters.DropShadowFilter;
import caurina.transitions.Tweener;
import caurina.transitions.properties.TextShortcuts;
[SWF(backgroundColor="#FFFFFF", width="465", height="465", frameRate="30")]
public class Main extends Sprite {
private var txt:TextField;
public function Main() {
//Wonderfl.capture_delay(2);
init();
}
private function init():void {
TextShortcuts.init();
var tf:TextFormat = new TextFormat();
tf.font = "_ゴシック";
tf.size = 36;
tf.align = TextFormatAlign.CENTER;
txt = new TextField();
addChild(txt);
txt.x = 30;
txt.y = 190;
txt.width = 405;
txt.height = 85;
txt.type = TextFieldType.DYNAMIC;
txt.selectable = false;
//txt.embedFonts = true;
//txt.antiAliasType = AntiAliasType.ADVANCED;
txt.defaultTextFormat = tf;
txt.textColor = 0xFFFFFF;
txt.filters = [new DropShadowFilter(2, 90, 0x000000, 0.4, 8, 8, 2, 3, false, false, false)];
//
txt.text = "www.project-nya.jp";
start();
}
private function start():void {
Tweener.addTween(txt, {_text: "www.project-nya.jp", time: 3, transition: "linear", onComplete: complete});
}
private function complete():void {
var timer:Timer = new Timer(500, 1);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, wait, false, 0, true);
timer.start();
}
private function wait(evt:TimerEvent):void {
evt.target.removeEventListener(TimerEvent.TIMER_COMPLETE, wait);
start();
}
}
}