利用Tweener製作動畫 – 廣告看板

依然是Tweener範例清倉,本篇範例大致是搭配Tweener讓目標物移動到指定座標的效果,話不多說看範例吧!

Tweener 橫幅廣告 範例:主要為利用Tweener針對廣告看板進行移動,以下為本範例的程式碼:

import caurina.transitions.Tweener;
var i:int;//迴圈用變數
var pic:int = 1;//播放張數紀錄變數
var clock;//計時器變數

//按鈕變色與監聽
btnChange();
function btnChange()
{
	for (i=1; i<=4; i++)
	{
		this["b" + i].gotoAndStop(1);
		this["b" + pic].gotoAndStop(2);
	}
}
for (i=1; i<=4; i++)
{
	this["b" + i].addEventListener(MouseEvent.CLICK,clickFn);
}
function clickFn(e:MouseEvent)
{
	clearInterval(clock);
	clock = setInterval(autoChange,5000);
	pic = e.currentTarget.name.substr(1,1);
	bannerChange();
	btnChange();
}

//計時器設定(每5秒更換)
clock = setInterval(autoChange,5000);
function autoChange()
{
	pic++;
	if (pic>4)
	{
		pic = 1;
	}
	bannerChange();
	btnChange();
}
//圖片切換函數
function bannerChange()
{
	Tweener.addTween(banner, {x:(pic-1)*-560, time:1, transition:"easeOutQuint"});
}

橫幅廣告 範例 原始檔 下載


Tweener 移動看板 範例:與上面範例大致相同,不過本範例增加了縱向的移動。

import caurina.transitions.Tweener
var i
var j
var targetX
var targetY

for(i=1;i<=3;i++){
	for(j=1;j<=3;j++){
		this["b"+i+j].addEventListener(MouseEvent.CLICK,moveFn)
	}
}
function moveFn(e:MouseEvent){
	targetX=(e.currentTarget.name.substr(2,1)-1)*-450
	targetY=(e.currentTarget.name.substr(1,1)-1)*-450
	Tweener.addTween(nb, {x:targetX, y:targetY, time:2, transition:"easeOutQuint"});
}

移動看板 範例 原始檔 下載

You may also like...

765 Responses

  1. vxdxbsdg表示:

    buy modafinil 100mg online cheap buy modafinil 100mg sale oral provigil 200mg

  2. MichaelPlela表示:

    tadalafil tablets 20 mg india tadalafil best price 20 mg cialis 20mg

  3. ubrynpdp表示:

    buy modafinil 100mg online cheap buy modafinil 100mg for sale provigil cheap

  4. MichaelPlela表示:

    online purchase of tadalafil in india cialis coupon cialis

  5. dadrrdyh表示:

    buy provigil 100mg online provigil 200mg pill

  6. wpbwwmrn表示:

    modafinil 200mg tablet buy provigil online order provigil 100mg without prescription

  7. CanadaTiz表示:

    prescribing stromectol stromectol 12 mg tablets stromectol 3 mg tablets price

  8. xjecogay表示:

    provigil 200mg cheap modafinil online buy provigil 100mg over the counter

  9. musujjvm表示:

    modafinil 200mg uk order modafinil 200mg order modafinil pills

  10. CanadaTiz表示:

    prescribing stromectol stromectol price usa buy stromectol online

  11. CanadaTiz表示:

    canada rx drugs online buying from canadian online pharmacies aarp approved canadian online pharmacies

  12. CharlesEvisy表示:

    ivermectin cream before and after rosacea ivermectin how much ivermectin to give a 50lb dog

  13. CharlesEvisy表示:

    propecia costs is propecia a prescription drug propecia costs

  14. CharlesEvisy表示:

    ivermectin 12 ivermectin lotion over the counter ivermectin ointment

  15. CharlesEvisy表示:

    prescription drugs online without doctor cheap pet meds without vet prescription anti fungal pills without prescription

  16. CharlesEvisy表示:

    prescription drugs canada buy online best non prescription ed pills buy prescription drugs

  17. CharlesEvisy表示:

    cheap ed pills best ed pills online pills for erection

  18. CharlesEvisy表示:

    treatments for ed ed remedies ed medication online

  19. Williamprats表示:

    where can i order prednisone 20mg buy prednisone online prednisone tablets canada

  20. Williamprats表示:

    generic cialis no prescription australia cialis usa prescription 20mg generic cialis

  21. Williamprats表示:

    what doe cialis look like cheapest cialis usa cialis 20 mg canada

  22. Williamprats表示:

    stromectol tablets buy online what worms does ivermectin kill in dogs ivermectin capsules for humans

  23. Williamprats表示:

    100mg viagra without a doctor prescription erection pills cheap medications

  24. Williamprats表示:

    stromectol dosage does oral ivermectin kill demodex mites ivermectin, metronidazole

  25. Heya i’m for the first time here. I found this board and I find It truly helpful & it helped me out much. I’m hoping to give one thing back and aid others like you aided me.

  26. I am regular reader, how are you everybody? This
    post posted at this web page is actually good.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。