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

  1. Buy The Initial Home By Qualifying To The Cheap Loan 다바오 와이너리 호텔

  2. Search Engine Ranking Factors For Article Marketers 구글상위노출

  3. Legitimate Home Business Online – Proven No-Cost Traffic Generation Strategies
    백링크 조회

  4. How To Correctly Implement Meta Data 백링크 구매

  5. Unsecured Loans – Methods To Your Credit Right Before You Apply 다바오 골프장 호텔

  6. I loved as much as you’ll receive carried out right here.
    The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get got an edginess over that you wish be delivering the following.

    unwell unquestionably come further formerly again as exactly the same nearly a lot often inside case you shield this increase.

    Look into my site: click here to read

  7. Way cool! Some very valid points! I appreciate you penning this article plus the rest of the site is extremely good.

  8. You’re so interesting! I do not think I’ve truly read something like this before. So great to discover another person with some genuine thoughts on this issue. Really.. thanks for starting this up. This site is something that’s needed on the web, someone with some originality.

  9. 14 Cartoons About Veterans Disability Claim To Brighten Your Day Veterans disability law firms

  10. Everything You Need To Be Aware Of Upvc
    Window Repairs Near Me upvc Windows and Doors

  11. You’ll Never Be Able To Figure Out This Veterans Disability Lawyers’s Tricks veterans disability lawyers

  12. SEO Management Services The Process Isn’t As Hard As You
    Think Professional Seo Services

  13. 0eZXS表示:

    tor洋葱浏览器https://cn-torproject.com yAGXjKvfD

  14. What Things To Consider Prior To Getting A Seo Consultant 검색엔진최적화 사례

  15. Vl05KMIREx表示:

    通过爱思助手官网下载这款强大的苹果设备管理工具,享受便捷的数据管理和设备维护功能。爱思助手支持一键备份、恢复以及应用安装,帮助您高效管理设备空间和应用。适合所有iOS用户,特别是频繁需要数据处理的专业人士。https://i4.com.vn/ gGnG7sH

  16. Great article! We are linking to this particularly great post on our website. Keep up the great writing.

  17. tubidy表示:

    Hi, I do believe this is an excellent blog. I stumbledupon it 😉 I am going to return yet again since I book marked it. Money and freedom is the greatest way to change, may you be rich and continue to help other people.

  18. Sued By Credit Card Company: Shooting For Debt Settlement 다바오 레이크

  19. Tips The Way To Make A Christmas Card Using Powerpoint Easily 무직자 대출 쉬운곳

  20. Uxiiue表示:

    buy verapamil 120mg without prescription – valsartan 160mg drug tenoretic generic

  21. Have You Considered Added Benefits Of An Automobile Loan? 다바오 포커 회원가입

  22. Article Marketing Tips – How Create Articles That Get Results 검색엔진최적화 배우기

  23. Horseshoe Skill Stop Video Slot Review 프라그마틱 플레이

  24. An outstanding share! I have just forwarded this onto a co-worker who has been conducting a little research on this. And he actually ordered me breakfast due to the fact that I stumbled upon it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanks for spending time to talk about this issue here on your web page.

  25. Some Wisdom On Door Fitter Luton From An Older Five-Year-Old Composite Front Doors Luton

  26. Home Loan – Move Into Your Dream House Already! 다바오 설치

  27. Top Seo Faq – What Is Really A Backlink?
    검색엔진최적화 seo

發佈留言

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