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

  1. Quick And Simple Keyword Assist Guide To Marketing Success 검색엔진최적화 회사

  2. A Holiday Loan Consider Boredom Outside Your Life 다바오 탁아소있는 호텔

  3. How Long Does It Take Construct Credit After Personal Chapter?
    다바오 홀덤 아이폰

  4. Bank Is In Charge Of People With Bad Credit 직장인 대출

  5. marengi.org表示:

    Review Of Vegas Red Online Casino 디지몬 어드벤처 라스트 에볼루션 인연 보기, marengi.org,

  6. A Look In The Secrets Of Window Doctor storm window Repair

  7. What Put Together About Poker Pro Fred Sarge Ferris 다바오 부티크 호텔

  8. The 10 Most Scariest Things About Cerebral Palsy Attorneys cerebral palsy attorneys

  9. Home Loans With Bad Credit: Get Yourself A Legit Loan In Three Easy Steps
    중소기업 대출

  10. Get Bank Loan Questions Answered Here 다바오 vpn 추천

  11. Bank Rate Loan Calculator: Free Straightforward 다바오 홀덤 머니상

  12. Why ADHD Private Assessment Is Fast Increasing To Be The Hottest Trend Of 2023 Private Adhd Assessment Newcastle Cost

  13. Ask Me Anything: 10 Responses To Your Questions About
    Door Doctor Near Me skylight window Replacement

  14. A How-To Guide For Peugeot 207 Key From Start To Finish peugeot 2008 Key fob Not working

  15. Acquaintance With Online Casino Vocabulary Is
    Important 에볼루션 주식시장

  16. Engaging You To Ultimately Online Personal Loans: Faster? Or Worst?
    다바오 발코니있는 호텔

  17. seo 마케팅表示:

    How To Correctly Use Search Keyword Tools seo 마케팅

  18. y2mate表示:

    I seriously love your blog.. Great colors & theme. Did you develop this amazing site yourself? Please reply back as I’m looking to create my very own blog and want to know where you got this from or what the theme is named. Thanks!

  19. legal表示:

    3 Reasons Three Reasons Your Fela Claims Railroad Employees Is Broken (And How To Repair It)
    legal

  20. Lashawn表示:

    12 Facts About Auto Accident Claim To Make You Think
    Twice About The Cooler. Cooler auto accident attorney (Lashawn)

  21. 다바오 kyc表示:

    Custom Card Making – Least Expensive Gifts Can Often Mean The Most
    다바오 kyc

  22. Bank Repo Cars – Buy Highly Affordable Cars At Auctions 카카오 대출

  23. Clemmie表示:

    7 Things You’ve Always Don’t Know About Private ADHD Assessment Edinburgh private adhd assessment devon (Clemmie)

  24. Meet With The Steve Jobs Of The Kia Duplicate Key Industry How To Get A Kia Replacement Key

  25. Personal Loans With Poor Credit Will Assist You Start Fresh 다바오 골프 호텔

發佈留言

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