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

  1. вывод из запоя дешево ростов на дону вывод из запоя дешево ростов на дону .

  2. Do Not Buy Into These “Trends” About Love Doll Realistic extremely realistic sex doll (https://loont.com)

  3. How To Create Successful Adult Entertainment Store How-tos And Tutorials To Create
    Successful Adult Entertainment Store Home Adult Toy Shop Near Me

  4. Jamesknowl表示:

    https://canadianpharmacy.win/# canadian drug pharmacy

  5. The 10 Scariest Things About Affordable Search Engine Optimisation Packages Uk Affordable Local seo Service

  6. 2 at 4:00 PM Tuesday, Jan 20, 2012.

  7. USSR, and this extended conflict between the nations became identified because the Cold Warfare.

  8. An alternate remedy has been developed for people who find themselves exposed to varicella but cannot be vaccinated.

  9. Hefty duct tape is a staple of many home repairs, whereas double-sided tape tacks up posters.

  10. We can say its serves as a security for the creditors of a business but it cannot be withdrawn to the determined of the creditors.

  11. On 25 September 2008, Renaissance wrote a comment letter to the Securities and Exchange Commission, discouraging them from implementing a rule change that would have permitted the public to access information regarding institutional investors’ short positions, as they can currently do with long positions.

  12. Brianchoky表示:

    http://canadianpharmacy.win/# real canadian pharmacy

  13. Five Killer Quora Answers On Cost Of Replacing Window With French Doors Cost Of Replacing Window With French Doors

  14. LarryHom表示:

    https://indianpharmacy.win/# top 10 online pharmacy in india

  15. нарколог на дом вывод из запоя краснодар нарколог на дом вывод из запоя краснодар .

  16. ClaytonGauct表示:

    mexico drug stores pharmacies: mexican drugstore online – mexican online pharmacies prescription drugs

  17. вывод из запоя краснодар стационар вывод из запоя краснодар стационар .

  18. JacobLoody表示:

    http://rlkk.ru — Выбор, которому доверяют наши клиенты. Оформляйте заказ прямо сейчас!

  19. JacobLoody表示:

    фабрика кухня — качество производства, проверенное временем.

  20. It’s The Ugly Real Truth Of Bromley Windows And Doors sash window repair Bromley

  21. Five Killer Quora Answers On Mens Best Sex
    Toys best male sex toys uk

  22. Jamestus表示:

    pharmacies in canada that ship to the us best online canadian pharmacy best mail order pharmacy canada

  23. вывод из запоя цены на дому краснодар вывод из запоя цены на дому краснодар .

  24. алкоголизм вывод из запоя краснодар алкоголизм вывод из запоя краснодар .

發佈留言

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