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

12,969 Responses

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

  2. When playing a free of charge version of any casino game, you will not be capable to claim any of your winnings.

    Feel free to surf to my webpage https://ko.anotepad.com/note/read/txfbi7ht

  3. gayporno表示:

    It’s actually very difficult in this busy life to listen news on TV, so I only use internet for that purpose, and take the newest news.

  4. Jeffreyvop表示:

    male erectile dysfunction: canadian pharmacy – ed pills cheap

  5. брокерские услуги по таможенному оформлению брокерские услуги по таможенному оформлению .

  6. StephenJem表示:

    https://canadianpharmi.com/# canadian online pharmacy

  7. компании таможенное оформление https://tamozhennyj-broker-moskva.ru/ .

  8. gayporno表示:

    Hey! Do you use Twitter? I’d like to follow you if that would be
    ok. I’m definitely enjoying your blog and look forward to new updates.

  9. Youre so cool! I dont suppose Ive read anything similar to this before. So nice to seek out somebody with many original ideas on this subject. realy appreciation for starting this up. this website is one area that is needed on the net, someone after some originality. helpful work for bringing interesting things on the internet!

  10. I have been exploring for a little bit for any high-quality articles or weblog posts on this kind of house . Exploring in Yahoo I finally stumbled upon this web site. Reading this info So i’m satisfied to express that I’ve an incredibly good uncanny feeling I came upon just what I needed.

  11. услуги по таможенному оформлению грузов услуги по таможенному оформлению грузов .

  12. StephenJem表示:

    https://canadianpharmi.com/# best ed pills

  13. Jeffreyvop表示:

    buying prescription drugs in mexico online: mexicanpharmi – mexican drugstore online

  14. Willardvem表示:

    http://canadianpharmi.com/# muse ed drug

  15. MatthewHen表示:

    best online drugstore Canadian pharmacy prices ed for men

  16. StephenJem表示:

    https://indiapharmi.com/# top online pharmacy india

  17. pretty valuable material, overall I believe this is really worth a bookmark, thanks

  18. Ernestzow表示:

    pharmacy website india: indiapharmi – top 10 pharmacies in india

  19. какие франшизы можно открыть какие франшизы можно открыть .

  20. Betovo_jima表示:

    Betovo Italia live casin? Betovo Italia live casin? .

  21. JacobLoody表示:

    кухни на заказ от производителя – Профессиональное изготовление кухонь на заказ с гарантией качества.

發佈留言

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