[flash]拉覇效果的banner

LINEで送る
[`evernote` not found]

很久沒有機會開FLASH了
應老闆要求做了這個拉霸BANNER

當然 還是把握機會練習AS3囉
用了tween,BlurFilter, setInterval, setTimeout
不過不曉得是哪一個的問題
會讓拉霸有時當掉停住
目前比較覺得是tween的問題
還需要在研究一下

setInterval+setTimeout可以實現定時分批開始的效果
再改一下atArr 的取得和加一些判斷按鈕就可以當真的拉霸玩了
細部的動態跟設計需要再做調整
調個太快就沒FLASH可以玩了 呵呵~

import fl.transitions.*;
import fl.transitions.easing.*;
 
stage.frameRate =30;
 
var blurMax:Number = 64;
var loopMax:Number = 3;
var stopArr :Array = new Array("",-142,-99,-51,0);
var atArr :Array = new Array("","44444","33333","22222","11111");
var newgoAt:Number;
function init():void {
	for (var i=1; i<=5; i++) {
		var tmc:MovieClip = this["mov"+i+"_mc"];
		tmc.gotoAndStop(i);
	}
	movebar();
	newgoAt = 1;
	var playbar = setInterval(movebar , 6000);
}
 
 
function movebar():void {
	newgoAt ++;
	newgoAt = newgoAt >4? 1:newgoAt;
	for (var i=1; i<=5; i++) {
		var tmc:MovieClip = this["mov"+i+"_mc"];
		tmc.looptime = 0;
		tmc.inblur = 0;
		setTimeout(next1,300*i,tmc);
	}
}
 
function next1(m:MovieClip):void {
	var myTween1:Tween = new Tween(m, "y", Regular.easeIn, m.y,100, 1, true);
	myTween1.looping = false;
	myTween1.addEventListener(TweenEvent.MOTION_FINISH,next2);
}
function next2(e:TweenEvent) {
	//trace("next2 run");
	e.target.removeEventListener(TweenEvent.MOTION_FINISH,next2);
	var myTween2:Tween = new Tween(e.target.obj, "y", null, -150, 150, 0.5, true);
	myTween2.addEventListener(TweenEvent.MOTION_LOOP,loopcheck);
	myTween2.addEventListener(TweenEvent.MOTION_CHANGE,blurit);
	myTween2.looping = true;
}
 
function loopcheck(e:TweenEvent):void {
	e.target.removeEventListener(TweenEvent.MOTION_CHANGE,blurit);
	e.target.obj.looptime < loopMax ?e.target.obj.looptime++:next3(e);
}
function next3(e:TweenEvent) {
	e.target.stop();
	//e.currentTarget.parent.removeChild(e.currentTarget);
	e.target.removeEventListener(TweenEvent.MOTION_LOOP,loopcheck);
	var num:Number = int(e.target.obj.name.substr(3,1))-1;
	var stopAt:Number = stopArr[atArr[newgoAt].substr(num,1)];
	var myTween3:Tween = new Tween(e.target.obj, "y", Regular.easeOut, stopAt-150,stopAt, 0.5, true);
	myTween3.looping = false;
	myTween3.addEventListener(TweenEvent.MOTION_CHANGE,blurit);
}
 
function blurit(e:TweenEvent):void {
	var _t = e.target;
	var _tt = Math.round(_t.time/_t.duration*100)/100;
	_t.obj.inblur += _tt;
	_tt = _t.finish == 150? _t.obj.inblur/7:1-_tt;
	var tblurY:Number =  _tt *blurMax;
	//_t.obj.name == "mov1_mc"?trace(e.target.obj.looptime,"---",_t.obj.inblur,"---",tblurY):null;
	var blur:BlurFilter = new BlurFilter(0, tblurY, BitmapFilterQuality.LOW);
	_t.obj.filters =  [blur];
}
init();

13 則迴響於《[flash]拉覇效果的banner

回應已關閉。