利用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,365 Responses

  1. BradleyEdino表示:

    slot oyunlar? slot siteleri slot oyunlar?

  2. The Morning Name. Related Press.

  3. Managing catering for occasions, venue bookings, stand-alone catering necessities or catering deliveries, EventPro’s catering-specific options are more in-depth, extra highly effective and extra flexible, so when combined with the complete capabilities of full event administration software program, EventPro is the system that may develop with what you are promoting – so far as you want to take it.

  4. Anybody who is capable to enter right into a contract should buy and sell shares out there.

  5. JacobLoody表示:

    http://www.a-p-i.ru — качественные кухни от профессионалов.

  6. Junie Pius表示:

    Step-by-Step na Gabay sa Pagpaparehistro sa https://grandclub-casino.com – grandclub para sa Mga Bagong User

  7. Dwain Ferioli表示:

    Paano I-download at I-install ang https://chillbet-casino.com – chillbet App para sa Mas Magandang Paglalaro

  8. porn video表示:

    I really like looking through a post that will make people think. Also, thanks for allowing me to comment.

  9. FrankEmine表示:

    guvenilir slot siteleri: slot oyunlar? – slot casino siteleri

  10. JasonUnsoG表示:

    http://slotsiteleri25.com/# slot oyunlar? puf noktalar?

  11. JacobLoody表示:

    кухни на заказ — Закажите кухню своей мечты по индивидуальному проекту от vizitnews.

  12. выведение из запоя на дому в екатеринбурге выведение из запоя на дому в екатеринбурге .

  13. Cyrus Purifoy表示:

    Simulan ang Iyong Adventure sa https://3dice-casino.com – 3dice na may $100 Bonus!

  14. Wifestb表示:

    I want as many people as possible to read this post and think about these words https://lghsv.ilyx.ru/id-7306.html

  15. What You Should Be Focusing On Improving Window Repairs Near Me
    upvc window Repairs near me

  16. JacobLoody表示:

    https://www.osmio.ru/ — только лучшее для вашей кухни.

  17. Albertina表示:

    14 Common Misconceptions Concerning Asbestosis Asbestos Mesothelioma Attorney mesothelioma lawsuits (Albertina)

  18. вывод из запоя [url=http://www.vyvod-iz-zapoya-ekaterinburg25.ru]вывод из запоя[/url] .

  19. Orvilleced表示:

    az parayla cok kazandiran slot oyunlar?: az parayla cok kazandiran slot oyunlar? – az parayla cok kazandiran slot oyunlar?
    online casino

發佈留言

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