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

10,492 Responses

  1. Important Points To Be Considered During Seo Promotion 구글상위노출 대행사

  2. Xoxtxi表示:

    order atenolol generic – oral coreg purchase carvedilol generic

  3. Google Genius表示:

    How To Very Much Profit From Seo Google Genius

  4. Home Equity Loans – The Smart Choice For Home Owners 다바오 여행
    (http://www.mech.vg)

  5. Swroom.com表示:

    You’ll Never Guess This Winning Slots’s Secrets winning slots (Swroom.com)

  6. boat Accident表示:

    Boat Accident Settlement Techniques To Simplify Your Daily Life Boat
    Accident Settlement Trick Every Person Should Be Able To boat Accident

  7. Tania表示:

    Guide To Upvc Repairs Near Me: The Intermediate Guide In Upvc Repairs Near Me upvc repairs near
    me, Tania,

  8. 20 Fun Infographics About Sectional With Bed And Recliner Modern sofa sectional Sleeper

  9. Upvc Windows Near Me Tools To Help You Manage Your Daily Life Upvc Windows Near Me Trick That Every
    Person Should Know upvc windows near Me

  10. Choosing A Keyword Tool: What Appear For Within 검색엔진최적화

  11. Slot deposit表示:

    Greetings! Very helpful advice within this post! It’s the little changes that make the largest changes. Thanks a lot for sharing!

  12. The 10 Most Scariest Things About Malpractice Attorneys malpractice attorneys

  13. This Most Common Lexus Key Fob Price Debate Isn’t As Black And White As You
    Think How To Replace Lexus Key

  14. 20 Resources That’ll Make You More Efficient At Windows Replacement Replacement windows cost

  15. Search Engine Marketing (Sem) – Houses On Sand 워드프레스 seo (http://vivasueno.com)

  16. seo 마케팅表示:

    Considering Page Title And Meta Tags For Seo seo 마케팅

  17. eng.stove.ru表示:

    Im And Seo – Why You’d Like Them Both 검색엔진최적화 방법
    [eng.stove.ru]

  18. Starting Premises Based Internet Business – Seo Facts And Figures 워드프레스 백링크

  19. 99811760.xyz表示:

    10 Pinterest Accounts To Follow Cost Of Spare Car Key 99811760.xyz

  20. 10 Veterans Disability Lawsuit Tricks All Experts Recommend Veterans Disability Law Firm

  21. attorneys表示:

    10 Meetups On Malpractice Attorney You Should Attend attorneys

  22. What Nissan Car Key Replacement Should Be Your Next Big Obsession nissan spare key replacement

  23. Meta Keywords: Myth And Reality 백링크 구매

  24. How To Create An Awesome Instagram Video About Jogging Pushchair http://www.037810.xyz

  25. 037810.xyz表示:

    15 Gifts For The Pushchairs And Strollers Lover In Your Life 037810.xyz

  26. Do Your Research And Opt For The Right Used Car Loans 소액 대출 – studiolight.com

  27. Leif表示:

    You’ll Never Guess This Window Replacement Near Me’s Tricks window replacement near
    me – Leif

發佈留言

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