การทำให้วัตถุเคลื่อนที่ตามเมาส์

Post on 28-May-2015

862 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1. สร้างเอกสารใหม่ขึ้นมา ขนาดใดก็ได้

2. สร้าง movie clip ขึ้นมาโดยไปท่ีเมนู insert > New Symbol หรือกด Ctrl+F8

3. เลือกชนิดเป็นแบบ Movie Clip

4. วาดรูปอะไรลงไปก็ได้

5. กลับไปท่ี Scene 1 โดยคลิกที่ Scene 1 ตามรูป

6. น า movie clip ที่สร้างขึ้น ไปวางไว้บน Stage

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 เพ่ือทดสอบ

top related