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

  1. upvc windows表示:

    The 10 Most Terrifying Things About Upvc Windows Repairs upvc windows

  2. ultfoms.Ru表示:

    The 10 Most Terrifying Things About Dangerous Drugs Attorneys dangerous
    drugs attorneys – ultfoms.Ru

  3. 10 Simple Ways To Figure Out Your Locksmiths Near Me For Car locksmith for Car Key

  4. An fascinating discussion may be worth comment. I do believe that you ought to write regarding this topic, may possibly not be considered a taboo subject but typically consumers are insufficient to speak on such topics. An additional. Cheers

  5. 15 Best Pinterest Boards To Pin On All Time About Mesothelioma Lawsuit Mesothelioma attorney Reviews

  6. The Advanced Guide To Greenpower Mobility Go Green Mobility Scooters (Greenpowermobilityscooter49763.Digitollblog.Com)

  7. Nice post. I learn something harder on distinct blogs everyday. Most commonly it is stimulating to learn content from other writers and exercise a specific thing from their store. I’d choose to use some while using content in my weblog whether you don’t mind. Natually I’ll supply you with a link in your internet blog. Thank you for sharing.

  8. What Do You Do To Know If You’re Set For
    Bed Double Mattress Best double Mattress

  9. Telegra.Ph表示:

    20 Up And Coming Three Wheeler Scooter For Handicapped Stars To Watch The Three
    Wheeler Scooter For Handicapped Industry 3-wheeled scooters [Telegra.Ph]

  10. This article was written by a real thinking writer. I agree many of the with the solid points made by the writer. I’ll be back.

  11. There are extremely lots of details like this take into consideration. This is a wonderful denote retrieve. I provide you with the thoughts above as general inspiration but clearly you will discover questions just like the one you mention where the most significant factor will be in honest great faith. I don?t know if recommendations have emerged around such thinggs as that, but I know that your chosen job is clearly known as a fair game. Both little ones glance at the impact of only a moment’s pleasure, throughout their lives.

  12. hi!,I really like your writing so much! share we be in contact more approximately your article on AOL? I require a specialist in this space to resolve my problem. Maybe that is you! Having a look ahead to peer you.

  13. I think this is among the most vital info for me. And i’m glad reading your article. But wanna remark on few general things, The website style is perfect, the articles is really great : D. Good job, cheers

  14. What’s The Current Job Market For Psychiatrists Near Me Professionals Like?
    Psychiatrists Near Me

  15. tubidy表示:

    Great article! We will be linking to this particularly great post on our website. Keep up the good writing.

  16. bathtub leaks表示:

    What’s Taking place i’m new to this, I stumbled upon this I have found It positively helpful and it has aided me out loads. I hope to give a contribution & help other users like its helped me. Good job.

  17. Kizkiuz.Com表示:

    15 Surprising Facts About Chest Freezers For
    Outbuildings Lg Fridge Uk (Kizkiuz.Com)

  18. 20 Things That Only The Most Devoted Linkbuilding Software Fans
    Know Seo backlink building software

  19. BOKEP表示:

    Good Blog join my site if want sex my love

  20. very nice put up, i certainly love this website, keep on it

  21. Many thanks for bothering to line all of this out for people. This particular posting was in fact very useful in my opinion.

  22. first aid kits… thank you for the informative information you have here!…

  23. The subsequent time I learn a weblog, I hope that it doesnt disappoint me as a lot as this one. I imply, I know it was my option to read, but I actually thought youd have one thing interesting to say. All I hear is a bunch of whining about one thing that you can fix in case you werent too busy searching for attention.

  24. I simply wanted to thank you so much once more. I’m not certain the things I could possibly have created in the absence of the actual smart ideas revealed by you on my situation. It actually was a alarming difficulty for me, however , looking at a professional tactic you dealt with that forced me to cry with gladness. Extremely happy for your service and even wish you really know what an amazing job you were accomplishing training other individuals all through a site. More than likely you haven’t come across any of us.

  25. Nice Website. You should think more about RSS Feeds as a traffic source. They bring me a nice bit of traffic

  26. blown表示:

    7 Secrets About Repair Double Glazed Window That No One Will Tell You blown

  27. Hamish表示:

    Why Nobody Cares About Slot Demo Gratis Pragmatic Play No
    Deposit gates of olympus slot demo indonesia (Hamish)

  28. 7 Simple Secrets To Totally Making A Statement With Your Mini Key
    Replacement Mini Cooper Key Fob

  29. Gksynl表示:

    buy finax pills – sildenafil 100mg canada purchase alfuzosin without prescription

發佈留言

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