practice ActionScript
テスト用のサンプルです
♥0 |
Line 27 |
Modified 2015-01-10 10:04:42 |
MIT License
archived:2017-03-20 13:00:06
ActionScript3 source code
/**
* Copyright komatsu ( http://wonderfl.net/user/komatsu )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/aI1K
*/
package {
import flash.text.TextFormat;
import flash.text.TextField;
import flash.display.Sprite;
import a24.tween.Tween24;
import a24.tween.Ease24;
public class FlashTest extends Sprite {
public function FlashTest() {
// コンストラクタ関数
var stageWidth:int = stage.stageWidth;//ステージサイズ幅
var stageHeight:int = stage.stageHeight;//ステージサイズ高さ
var tf:TextField = new TextField();
tf.x = stageWidth;
tf.y = ( stageHeight - tf.height ) / 2; //中心位置
tf.width = stageWidth;//幅をステージと同じサイズにする
tf.selectable = false;//選択不可にする
var format:TextFormat = new TextFormat();//表示のフォーマットを作成
format.size = 50;//サイズの設定
format.align = "center";//揃えの設定
format.color = 0x0000ff;//色の設定
tf.text = "Hello world!";//文字の入力
tf.setTextFormat(format);//フォーマットの適用→文字の入力後にフォーマットを適用すること
addChild(tf);//表示リストに追加する
Tween24.tween(tf , 1 , Ease24._2_QuadOut).x(0).delay(1).play();
Tween24.tween(tf , 1 , Ease24._2_QuadIn).x(-stageWidth).delay(5).play();
}
}
}