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

706 Responses

  1. AndrewEcork表示:

    order cialis tadalafil no prescription female cialis

  2. AndrewEcork表示:

    cialis 50mg price tadalafil 20mg cialis is for daily use

  3. AndrewEcork表示:

    cialis without prescriptions uk tadalafil 20mg cialis quebec dollars canadien

  4. hub表示:

    I think I will become a great follower.Just want to say your post is striking. The clarity in your post is simply striking and i can take for granted you are an expert on this subject.

  5. chat表示:

    Substantially, the post is really the best on this laudable topic. I concur with your conclusions and will eagerly watch forward to your future updates.Just saying thanx will not just be enough, for the wonderful lucidity in your writing.

  6. hot表示:

    Might we expect to see more of these same problems in the future?

  7. AndrewEcork表示:

    cialis/dapoxetine with overnight ship buy cialis in australia online new cialis commercial 2010

  8. top表示:

    Enjoyed reading through this, very good material. Thanks!

  9. tube表示:

    I think it is a nice point of view. I most often meet people who rather say what they suppose others want to hear. Good and well written! I will come back to your site for sure!

  10. live表示:

    I am glad to talk with you and you give me great help

  11. AndrewEcork表示:

    cheap cialis pills uk is it legal to buy cialis online? where do you inject liquid cialis

  12. AndrewEcork表示:

    can ubuy cialis on streets cialis cialis with dapoxitine

  13. AndrewEcork表示:

    cialis kidney function generic version of cialis buy viagra cialis mix online

  14. CraigDor表示:

    viagra amazon sildenafil 100 mg buying viagra online

  15. CraigDor表示:

    buy generic 100mg viagra online viagra pills viagra from canada

  16. Jamested表示:

    stromectol for sale stromectol for humans for sale stromectol 12 mg tablets

  17. Jamested表示:

    stromectol 12 mg tablets stromectol tablets for humans stromectol 12 mg tablets

  18. Jamested表示:

    stromectol for sale stromectol tablets for humans mectizan stromectol

  19. ytpwfblw表示:

    buy generic provigil 100mg order generic modafinil 200mg

  20. MichaelPlela表示:

    viagra tablets for men sildenafil citrate 100mg for sale viagra

  21. MichaelPlela表示:

    tadalafil best price 20 mg tadalafil 20 mg buy online lowest price tadalafil

  22. MichaelPlela表示:

    where to buy cheap clomid online clomid for sale clomid for sale

  23. ipbyyewj表示:

    provigil us buy modafinil 100mg pill modafinil 200mg tablet

  24. sycjyycu表示:

    buy modafinil for sale modafinil 100mg generic

  25. MichaelPlela表示:

    tadalafil without a doctor’s prescription tadalafil generic tadalafil 20mg india

發佈回覆給「MichaelPlela」的留言 取消回覆

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