96's blog

WEBサイト制作科 6ヶ月コース

ActionScript03(onClipEventハンドラ)

  • 講師記録「Flash-アルゴリズムの構築」
  • IllustratorからFlashに画像の移行 AiでコピーFlでペースト
  • コメントアウト 1行は//○○ 複数行では/*○○*/
  • 表示→ペーストボードのチェックを外すと右端あわせ。

画像が静止状態から加速していくプログラム

  • 画像に記述する場合。
onClipEvent(load){
	speed=0;
	accel=1;
}
onClipEvent(enterFrame){
	speed +=accel;
	this._x +=speed;
}
  • actionレイヤーに記述する場合。(ActionScriptで関数を使う場合は、インスタンスではなくタイムラインにactionレイヤーを作って記述する。)
var speed:Number;
var accel:Number;

this.onLoad=function(){
	speed=0;
	accel=1;
}
cat_mc.onEnterFrame=function(){
	speed +=accel;
	cat_mc._x +=speed;
	trace(speed);
}