利用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...

15,359 Responses

  1. сравнение процессоров amd http://topcpu.ru/ .

  2. What’s The Current Job Market For Patio Doors Repair
    Professionals Like? Patio doors Repair

  3. Luanne Ambrosia表示:

    https://slotsgo-ph.com – slotsgo Registration Bonus: Libreng $100 Para sa Mga Bagong User!

  4. Jospeh Mozie表示:

    Subukan ang https://lucky-cola-slot.com – lucky cola slot, kung saan makakahanap ka ng mga sikat na laro sa pagsusugal tulad ng poker, blackjack, at iba pa. Tinitiyak ng platform ang patas na paglalaro at makatarungang sistema. Huwag palampasin ang pagkakataong makakuha ng mga bonus na nagbibigay ng dagdag na halaga sa iyong gaming experience.

  5. сравнение процессоров amd http://www.topcpu.ru/ .

  6. Xuan Czerniak表示:

    Paano Maabot ang https://wj-slot-ph.com – wj slot Customer Service para sa Iyong Mga Tanong?

  7. babe138表示:

    Ahaa, its nice dialogue about this piece of writing here at this web site, I have
    read all that, so at this time me also commenting at this place.

  8. Joel Shippy表示:

    Ang https://tg77slot.com – tg77 slot App ay tinitiyak na ang iyong gaming experience ay hindi lang magaan, kundi mabilis at seamless. I-download at i-install ito upang maranasan ang optimized na interface na nagbibigay ng pinakamahusay na karanasan sa paglalaro.

  9. Kasi Alliman表示:

    Mag-enjoy ng Mas Makatarungang Laro sa https://chipsgg-casino.com – chipsgg App: Paano I-download at I-install

  10. какой процессор лучше http://www.topcpu.ru .

  11. JacobLoody表示:

    кухни под заказ — Индивидуальный подход к созданию кухонь под заказ от ведущих мастеров.

  12. Norberto Asam表示:

    https://vvjlslot.com – vvjl slot: Ang Iyong Partner sa Propesyonal na Customer Service

  13. рейтинги производительности процессоров рейтинги производительности процессоров .

  14. Rema Schlanger表示:

    Bagong Player? Mag-sign Up sa https://stake-ph.com – stake Para sa Libreng $100 Bonus!

  15. 5 Killer Quora Answers On Lawyers For Accidents Near Me lawyers for accidents near me
    (https://nerdgaming.science)

  16. xxx porn表示:

    You are so cool! I don’t think I’ve truly read through a single thing like this before. So great to find someone with some unique thoughts on this issue. Really.. many thanks for starting this up. This web site is one thing that is required on the internet, someone with some originality.

  17. Ewa Heppner表示:

    https://marvel-ph.com – marvel: Platform na Puno ng Sikat na Laro at Bonus

  18. JacobLoody表示:

    http://www.umalutki.ru — На нашем сайте вы найдете всё необходимое для создания кухни вашей мечты.

  19. Wallacefex表示:

    slot oyunlar? puf noktalar?: slot oyunlar? – az parayla cok kazandiran slot oyunlar?

  20. JacobLoody表示:

    кухни под заказ — Индивидуальный подход к созданию кухонь под заказ от ведущих мастеров.

  21. Once you are convinced of the benefits of the investment in the cryptocurrency network, you need to work out the surplus amount that you would want to invest.

  22. Get To Know With The Steve Jobs Of The You Can Buy A Driving
    License Industry FüHrerschein Kaufen In Deutschland

  23. Subject: Standard containing generally accepted pointers for the implementation of an Information Safety Administration System within any given organisation.

發佈留言

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