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

6,943 Responses

  1. What’s The Job Market For Purchase Online With Bank Account Professionals?

    purchase online With bank account

  2. Guide To Fela Settlements: The Intermediate Guide On Fela Settlements Fela settlements

  3. actually, i like the body of Daniel Craig. wish i could have a body like that’

  4. order表示:

    Why Treadmill Sale Is The Next Big Obsession order

  5. Definitely believe that which you said. Your favorite justification appeared to be on the internet the easiest thing to be aware of. I say to you, I definitely get annoyed while people consider worries that they just do not know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people can take a signal. Will likely be back to get more. Thanks

  6. form of gotten in a rut. I think what you have mentioned here along with the taking of my force factor will assist me review all my possibilities and

  7. If your planner works alone, determine whether he or she will be able to handle all the wedding details, especially on your wedding day.

  8. The One Metal Anal Plugs Mistake That Every Beginning
    Metal Anal Plugs User Makes Best Anal toys

  9. Tonic Greens表示:

    Your home is valueble for me. Thanks!…

  10. You’ll Be Unable To Guess The Window Doctor’s Tricks The Window Doctor

  11. 10 Healthy Habits For A Healthy Slot Walk-Throughs Top Mobile Slots

  12. Great info دِراسَةٌ تُؤكّد : تثبيتُ ورقةٍ ØŒ بحجمِ قُصاصة، بإمكانها تقليص عدد المرضى الذين يُعانون من مرض القلب | هندسة نت I am interested to learn exactly what blog system you are working with? I’m having a few minor security issues with my latest site plus I’d like to locate some thing better and risk-free. Are there some suggestions! By the way how about Egypt dramatic news flash… Regards Drip Irrigation System

  13. What’s The Job Market For Best Bunk Beds To Buy Professionals?
    best bunk beds to Buy

  14. Most reliable human being messages, nicely toasts. are already provided gradually during the entire wedding celebration and therefore are anticipated to be very laid back, humorous and as well as new all at once. best man speech

  15. Dude; This unique website is the best – Gulvafslibning | Kurt Gulvmand ! Just how did you cause it to be appear this very good … Regards Flash Website Builder

  16. Don’t Buy Into These “Trends” Concerning Treadmill Treadmills sale uk

  17. Responsible For The Fridge Freezer 50/50 Frost Free Budget?
    12 Top Notch Ways To Spend Your Money built in fridge freezer 50 50 [https://cs.xuxingdianzikeji.com/home.php?mod=space&uid=1364211&do=profile&from=space]

  18. A Peek At Replacement Upvc Door Panels’s Secrets Of Replacement Upvc Door
    Panels Upvc door panels Replacements

  19. What’s The Most Creative Thing That Are Happening With Citroen Key Replacement Near Me who lost key To Car Citroen

  20. When I originally commented I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on every time a comment is added I get 4 emails with the exact same comment. Is there a way you can remove me from that service? Thanks a lot.

  21. NG Konveksi表示:

    Greetings! Very useful advice within this article! It’s the little changes that will make the largest changes. Many thanks for sharing!

  22. What Fridge Freezer With Plumbed Water Dispenser
    Experts Want You To Know? fridge With Water and ice Dispenser (fridge48239.wikipublicist.com)

  23. 9 Things Your Parents Taught You About Online Shopping Companies In Uk Online Shopping Companies In Uk

  24. 9 Things Your Parents Teach You About Capsule Machine Coffee capsule Machine coffee

  25. Francisco表示:

    14 Smart Ways To Spend Your Extra Accident Legal Budget accident
    law firms (Francisco)

  26. Selling A Walmart Gift Certificate 대출 (http://Gatewick.Com/)

  27. I’ll immediately grasp your rss feed as I can not find your e-mail subscription hyperlink or newsletter service. Do you have any? Kindly let me recognise so that I may just subscribe. Thanks.

  28. 15 Things You Don’t Know About Best American-Style Fridge Freezer Cheapest American Style Fridge Freezer

  29. 417177.xyz表示:

    How You Can Use A Weekly SEO Company London UK Project Can Change Your Life 417177.xyz

  30. Some genuinely nice stuff on this website , I enjoy it.

發佈留言

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