forked from: STAR WARS opening crawl
// forked from undo's STAR WARS opening crawl
package
{
import flash.display.*;
import flash.events.Event;
import flash.events.FocusEvent;
import flash.geom.PerspectiveProjection;
import flash.geom.Point;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
[SWF(backgroundColor=0x000000,frameRate=60)]
public class ASTest extends Sprite
{
private var _input:TextField;
private var _output:TextField;
private var _primitive:Sprite;
public function ASTest()
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(evt:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var pp:PerspectiveProjection = this.transform.perspectiveProjection;
pp.projectionCenter = new Point(stage.stageWidth/2, 0);
var backGround:Sprite = addChild(new Sprite()) as Sprite;
backGround.graphics.beginFill(0x0);
backGround.graphics.drawRect(0,0,stage.stageWidth, stage.stageHeight);
backGround.graphics.endFill();
for(var i:int = 0; i < 109; i++)
{
var star:Sprite = backGround.addChild(new Sprite()) as Sprite;
star.graphics.beginFill(0xffffff, Math.random()*0.5+0.5);
star.graphics.drawCircle(0,0,Math.random()*1+1);
star.graphics.endFill();
star.x = Math.random()*stage.stageWidth;
star.y = Math.random()*stage.stageHeight;
}
_primitive = addChild(new Sprite()) as Sprite;
_output = _primitive.addChild(new TextField()) as TextField;
_input = addChild(new TextField()) as TextField;
_input.type = TextFieldType.INPUT;
_input.background = true;
_input.border = true;
_input.wordWrap = true;
_input.multiline = true;
_input.text = 'It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire. During the battle, Rebel spies managed to steal secret plans to the Empire’s ultimate weapon, the DEATH STAR, an armored space station with enough power to destroy an entire planet. Pursued by the Empire’s sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her people and restore freedom to the galaxy...';
//_input.text = 'ルイズ!ルイズ!ルイズ!ルイズぅぅうううわぁああああああああああああああああああああああん!!! あぁああああ…ああ…あっあっー!あぁああああああ!!!ルイズルイズルイズぅううぁわぁああああ!!! あぁクンカクンカ!クンカクンカ!スーハースーハー!スーハースーハー!いい匂いだなぁ…くんくん んはぁっ!ルイズ・フランソワーズたんの桃色ブロンドの髪をクンカクンカしたいお!クンカクンカ!あぁあ!! 間違えた!モフモフしたいお!モフモフ!モフモフ!髪髪モフモフ!カリカリモフモフ…きゅんきゅんきゅい!! 小説11巻のルイズたんかわいかったよぅ!!あぁぁああ…あああ…あっあぁああああ!!ふぁぁあああんんっ!! アニメ2期決まって良かったねルイズたん!あぁあああああ!かわいい!ルイズたん!かわいい!あっああぁああ! コミック2巻も発売されて嬉し…いやぁああああああ!!!にゃああああああああん!!ぎゃああああああああ!! ぐあああああああああああ!!!コミックなんて現実じゃない!!!!あ…小説もアニメもよく考えたら… ル イ ズ ち ゃ ん は 現実 じ ゃ な い?にゃあああああああああああああん!!うぁああああああああああ!! そんなぁああああああ!!いやぁぁぁあああああああああ!!はぁああああああん!!ハルケギニアぁああああ!! この!ちきしょー!やめてやる!!現実なんかやめ…て…え!?見…てる?表紙絵のルイズちゃんが僕を見てる? 表紙絵のルイズちゃんが僕を見てるぞ!ルイズちゃんが僕を見てるぞ!挿絵のルイズちゃんが僕を見てるぞ!! アニメのルイズちゃんが僕に話しかけてるぞ!!!よかった…世の中まだまだ捨てたモンじゃないんだねっ! いやっほぉおおおおおおお!!!僕にはルイズちゃんがいる!!やったよケティ!!ひとりでできるもん!!! あ、コミックのルイズちゃああああああああああああああん!!いやぁあああああああああああああああ!!!! あっあんああっああんあアン様ぁあ!!セ、セイバー!!シャナぁああああああ!!!ヴィルヘルミナぁあああ!! ううっうぅうう!!俺の想いよルイズへ届け!!ハルケギニアのルイズへ届け!';
_input.width = stage.stageWidth*1.6;
_input.x = 10;
_input.y = 10;
_input.alpha = 0.2;
_input.addEventListener(FocusEvent.FOCUS_IN, onFocusIn);
_input.addEventListener(FocusEvent.FOCUS_OUT, onFocusOut);
_input.addEventListener(Event.CHANGE, onChange);
var tf:TextFormat = new TextFormat('_sans', 24, 0xEAC968);
_output.defaultTextFormat = tf;
_output.wordWrap = true;
_output.multiline = true;
_output.width = stage.stageWidth/1.5;
_output.x = -_output.width/2;
_output.selectable = false;
_primitive.rotationX = -96;
_primitive.x = stage.stageWidth/2;
_primitive.y = stage.stageHeight/1.5;
_primitive.z = -Math.sqrt(stage.stageHeight)*10;
_primitive.mouseEnabled = _primitive.mouseChildren = false;
onChange();
addEventListener(Event.ENTER_FRAME, onEnter);
}
private function onFocusIn(evt:FocusEvent):void
{
_input.alpha = 1;
}
private function onFocusOut(evt:FocusEvent):void
{
_input.alpha = 0.2;
}
private function onChange(evt:Event=null):void
{
_output.text = _input.text;
_output.height = _output.textHeight + 5;
_primitive.z = -Math.sqrt(stage.stageHeight)*4;
}
private function onEnter(evt:Event):void
{
_primitive.z += 0.25;
}
}
}