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

  1. Если вы искали где отремонтировать сломаную технику, обратите внимание – техпрофи

  2. A thoughtful insight and ideas I will use on my website. Youve obviously spent some time on this. Congratulations!

  3. KingGame表示:

    Pretty! This has been an extremely wonderful post. Many thanks for supplying these details.

  4. KingGame表示:

    Next time I read a blog, Hopefully it won’t disappoint me as much as this one. After all, I know it was my choice to read through, but I actually thought you would probably have something interesting to talk about. All I hear is a bunch of crying about something you could fix if you were not too busy looking for attention.

  5. Профессиональный сервисный центр по ремонту фото техники от зеркальных до цифровых фотоаппаратов.
    Мы предлагаем: отремонтировать проекционный экран
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  6. Профессиональный сервисный центр по ремонту фото техники от зеркальных до цифровых фотоаппаратов.
    Мы предлагаем: ремонт фотоаппаратов в москве
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  7. Если вы искали где отремонтировать сломаную технику, обратите внимание – ремонт бытовой техники в челябинске

  8. Exceptional post however , I was wanting to know if you could write a litte more on this topic? I’d be very thankful if you could elaborate a little bit more. Thanks!

  9. Excellent read, I just passed this onto a colleague who was doing a little research on that. And he really bought me lunch because I located it for him smile So let me rephrase that: Thanks for lunch!

  10. I would like to thanks for that attempts you have made in producing this guide. I’m going to the exact same best do the job in the future too. In fact your fanciful writing skills has motivated me to begin my personal blog now. Really the blog is distribution its wings rapidly. Your create up is really a fine sample of it.

  11. Spot on with this write-up, I absolutely believe that this site needs a great deal more attention. I’ll probably be returning to read more, thanks for the advice!

  12. I used to be able to find good information from your blog posts.

  13. Hi! I just would like to give you a huge thumbs up for the great information you have right here on this post. I am returning to your web site for more soon.

  14. Vrwoqt表示:

    buy pyridostigmine without a prescription – imitrex 25mg generic cheap azathioprine 50mg

  15. Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
    Мы предлагаем: ремонт крупногабаритной техники в москве
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  16. lemme curb表示:

    Everything is very open with a precise clarification of the challenges. It was really informative. Your site is useful. Thank you for sharing.

  17. elf bar price表示:

    Everything is very open with a very clear description of the issues. It was definitely informative. Your site is very useful. Many thanks for sharing!

  18. elf bar price表示:

    The very next time I read a blog, I hope that it doesn’t disappoint me as much as this one. I mean, Yes, it was my choice to read through, nonetheless I really believed you’d have something useful to talk about. All I hear is a bunch of moaning about something you can fix if you were not too busy searching for attention.

  19. Профессиональный сервисный центр по ремонту варочных панелей и индукционных плит.
    Мы предлагаем: ремонт электрических панели
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  20. WilliamAnedy表示:

    Рекомендуем вам обязательно посетить вот этот сайт –
    Unlim казино рабочее зеркало

  21. After going over a number of the articles on your website, I really like your technique of writing a blog. I book marked it to my bookmark webpage list and will be checking back soon. Take a look at my website too and let me know how you feel.

  22. Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
    Мы предлагаем:сервис центры бытовой техники екатеринбург
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  23. This post gave fantastic insight. I truly enjoyed going through it. This post is very structured and easy to comprehend.

  24. Good article. I definitely love this site. Keep it up!

  25. Some truly interesting information, well written and generally user friendly .

  26. I was able to find good info from your content.

  27. Augustine thanks for sharing this! My extensive google search has now been recently paid for using quality insight to talk about together with our relatives.

發佈留言

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