Flash Tut: Arrow Cursor Move

วันนี้มี Tutorial Flash Actionscript น่ารักขำๆมาให้ดูกัน
เป็นลูกเล่นของการเคลื่อนที่ของ Cursor แล้วเจ้าลูกศรนี้จะชี้ไปในทิศทางที่ Cursor อยู่
เอาไว้ Design ลูกเล่น ขำๆให้กับงานของเรา อาจจะเป็น Flash CD, หรือ Flash site ก็น่ารักดีครับ

ลองเข้ามาดูครับ

ขั้นตอน
1. สร้าง mc ให้ชื่อว่า arrow ขึ้นมา
2. เข้าไปใส่ ac ขั้นในตามนี้ ใน Flame ที่ 1

mouse_x = _root._xmouse;
mouse_y = _root._ymouse;
x = mouse_x - this._x;
y = mouse_y - this._y;
theta = Math.atan(y/x) * (180/Math.PI);
if (x == 0) {
 x = 1;
}
if (x > 0) {
 theta = theta + 90;
}
if (x < 0) {
 theta = theta - 90;
}
this._rotation = theta - 90;

3. ส่วนเฟรมที่ 2 ก็

gotoAndPlay(1);

ง่ายๆครับ แล้วก็ copy mc ชื่อ arrow มาวางบนงานหลายๆตัว
แค่นี้ก็น่ารักแล้ว

Please enable Javascript and Flash to view this Flash video.

Download FLA: Arrow Cursor Move

Tags: ,

One Response to “Flash Tut: Arrow Cursor Move”

  1. Flash Tut: Arrow Cursor Move | BLOG [in] TREND : เว็บบล็อกดี ๆ ที่ อินเทรนด์ Says:
    March 9th, 2009 at 11:55 am

    [...] ง่ายๆครับ แล้วก็ copy mc ชื่อ arrow มาวางบนงานหลายๆตัว แค่นี้ก็น่ารักแล้ว Click here to view the embedded video. [...]

Leave a Reply