More Related Content
More from Augusts Programmer
More from Augusts Programmer (20)
การทำให้วัตถุเคลื่อนที่ตามเมาส์
- 1. 1. สร้างเอกสารใหม่ขึ้นมา ขนาดใดก็ได้
2. สร้าง movie clip ขึ้นมาโดยไปที่เมนู insert > New Symbol หรือกด Ctrl+F8
3. เลือกชนิดเป็นแบบ Movie Clip
4. วาดรูปอะไรลงไปก็ได้
5. กลับไปที่ Scene 1 โดยคลิกที่ Scene 1 ตามรูป
6. นา movie clip ที่สร้างขึ้น ไปวางไว้บน Stage
- 2. 7. คลิกขวาที่ movie clip แล้วเลือก Actions ดังรูป
8. ใส่ Actionscript ลงไปดังนี้
onClipEvent (enterFrame) {
this._x += (_root._xmouse-this._x)/10;
this._y += (_root._ymouse-this._y)/10;
}
9. กด Ctrl+enter เพื่อทดสอบ