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

705 Responses

  1. PABAKAWLBIXhb表示:

    cost cheap lyrica without insurance can i purchase lyrica price buying cheap lyrica tablets

  2. Easterpisn表示:

    top ten essay writing services
    help with essays
    cheap custom essays

  3. Its wonderful as your other blog posts : D, regards for putting up.

  4. AABAKAWLBIXvx表示:

    cost of cheap lyrica without rx can i buy cheap lyrica without prescription can i purchase generic lyrica without rx

  5. Vivienepisn表示:

    college essay editing service
    write my essay fast
    review of essay writing services

  6. I am lucky that I discovered this website , precisely the right info that I was searching for! .

  7. PABAKAWLBIXat表示:

    where to get lyrica tablets where can i get cheap lyrica no prescription where to get lyrica pills

  8. scb99表示:

    You are my inspiration , I possess few web logs and very sporadically run out from to brand 🙁

  9. Ginniepisn表示:

    custom application essay
    writing an essay help
    customer essay

  10. LABAKAWLBIXyc表示:

    pregabalin 150 mg cost lyrica 150 mg pills pregabalin 150 mg uk

  11. LABAKAWLBIXtc表示:

    order pregabalin 75 mg online cheap pregabalin order lyrica uk

  12. Ginniepisn表示:

    mba application essay writing service
    college essay help long island
    application essay help

  13. casinosite表示:

    Hello ! I am the one who writes posts on these topics casinosite I would like to write an article based on your article. When can I ask for a review?

  14. Hello there, You have done an incredible job. I will certainly digg it and personally recommend to my friends. I am sure they will be benefited from this site.

  15. DABAKAWLBIXgr表示:

    cheap neurontin 400 mg buy gabapentin 100 mg neurontin 100 mg uk

  16. sbobet表示:

    There most be a solution for this problem, some people think there will be now solutions, but i think there wil be one.

  17. DABAKAWLBIXvl表示:

    order neurontin 100 mg for sale purchase gabapentin generic brand neurontin 100 mg

  18. I love what you’ve created here, this is definitely one of my favorite sites to visit.

  19. I am glad to be one of the visitors on this great site (:, appreciate it for putting up.

  20. Good site! I truly love how it is easy on my eyes it is. I am wondering how I might be notified when a new post has been made. I’ve subscribed to your RSS which may do the trick? Have a great day!

  21. Ginniepisn表示:

    urgent custom essays
    help with essay writing
    essay writers

  22. I thought it was going to be some boring old post, but I’m glad I visited. I will post a link to this site on my blog. I am sure my visitors will find that very useful.

  23. VABAKAWLBIXoy表示:

    buy diovan 80 mg buy valsartan 80 mg pill valsartan canada

  24. Cthrinepisn表示:

    best essay help
    write my college essay
    help me essays

  25. Find Out表示:

    I really believe you will do well in the future I appreciate everything you have added to my knowledge base.

  26. This blog post is excellent, probably because of how well the subject was developed. I like some of the comments too though I could prefer we all stay on the subject in order add value to the subject!

  27. Leilahpisn表示:

    cheap essays writing service
    essay on helping poor people
    professional essay editing service

  28. lonpao表示:

    I just couldnt leave your website before saying that I really enjoyed the useful information you offer to your visitors… Will be back often to check up on new stuff you post!

  29. Twylapisn表示:

    essays services
    buy cheap essays online
    professional essay writer

  30. I am very happy to look your post. Thanks a lot and i am taking a look ahead to touch you.

發佈回覆給「VABAKAWLBIXoy」的留言 取消回覆

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