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

12,891 Responses

  1. sky88表示:

    You should be a part of a contest for one of the best sites on the web. I am going to highly recommend this website!

  2. sky88表示:

    Spot on with this write-up, I seriously think this website needs a lot more attention. I’ll probably be returning to read through more, thanks for the information!

  3. 오피表示:

    I couldn’t agree more with your conclusions.오피

  4. Carrier Oils For Massage With Essential Oils 북구오피 (lf.yadingtour.com)

  5. plumbernearmeservic表示:

    Looking for professional drain cleaning? Brazos Plumbing in League City offers thorough and reliable drain cleaning services for homes and businesses. Drain cleaning

  6. I want to to thank you for this very good read!! I definitely enjoyed every little bit of it. I’ve got you saved as a favorite to look at new things you post…

  7. A Checklist For Preparing For A Memorable Party 수성구오피

  8. ngentot pepek表示:

    I really love your site.. Pleasant colors & theme. Did you develop this site yourself? Please reply back as I’m trying to create my very own site and would like to learn where you got this from or what the theme is called. Kudos.

  9. link bokep表示:

    You are so interesting! I don’t suppose I’ve truly read anything like this before. So nice to discover someone with genuine thoughts on this subject matter. Seriously.. thanks for starting this up. This website is something that is needed on the internet, someone with a little originality.

  10. bokep smp表示:

    I used to be able to find good advice from your content.

  11. 부산오피表示:

    A Post On The Fujikura 1000 Shiatsu Massage Chair 부산오피

  12. bokep indo表示:

    Saved as a favorite, I like your blog.

  13. I love how you write, it had me thinking. I??m going to bookmark this.

  14. ngentot pepek表示:

    Aw, this was an extremely nice post. Taking a few minutes and actual effort to generate a good article… but what can I say… I procrastinate a lot and don’t seem to get nearly anything done.

  15. I am commenting to let you know what a exceptional experience my wife’s child enjoyed viewing your webblog. She picked up many details, with the inclusion of what it is like to have an amazing giving mindset to make a myriad of people effortlessly have an understanding of a variety of specialized subject matter. You honestly inspired her. Thank you for offering the important, safe, edifying not to mention easy pointers regarding your subject to Evelyn. Thanks,

  16. link bokep表示:

    bookmarked!!, I love your website!

  17. BOKEP JEPANG表示:

    Very Good blog im interested for about that

  18. This post is incredibly informative. I genuinely enjoyed going through it. The details is extremely arranged and straightforward to follow.

  19. As I web-site possessor I believe the content material here is rattling wonderful , appreciate it for your efforts. You should keep it up forever! Best of luck. Rent a car kosova

  20. bokep indo表示:

    Can I just say what a relief to find a person that truly knows what they’re discussing over the internet. You definitely understand how to bring a problem to light and make it important. More people must read this and understand this side of the story. I was surprised you’re not more popular because you certainly have the gift.

  21. The two dining establishments beneath the bridge are Snoopy’s and Doc’s. Snoopy’s seems to be the much more remarkably regarded, but we do not comprehend why. Snoopys is just a fried fish-shack. You order at the counter and select up your unique meals served on paper plates. It is money only, and it has no bar just beer. Doc’s has waiters, real plates, and a complete bar. They each have terrific sunset views about the lagoon, but neither appeared to have air-conditioning.

  22. ngentot pepek表示:

    A motivating discussion is definitely worth comment. I do think that you should write more on this topic, it might not be a taboo subject but typically people don’t speak about these issues. To the next! All the best.

  23. Greetings, Could I grab your own photograph and make use of it on my own blog page?

  24. I visited a lot of website but I think this one has got something extra in it in it

  25. bokep smp表示:

    Hello! I just want to give you a huge thumbs up for your excellent info you have here on this post. I’ll be returning to your site for more soon.

發佈留言

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