The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features
See the new ForumsYou need to be logged in to post in the forums. If you do not have an account, please sign up first.
Giải bài tập Prop_Moving (dùng MouseEvent)
Để di chuyển đối tượng ta dùng 2 phương thức:+startDrag() : gọi phương thức này để duy chuyển đối tượng
+stopDrag() : Gọi phương thức này để dừng di chuyển đối tượng
Áp dụng cho bài tập:
+dùng startDrag() : dùng cho đối tượng với sự kiện MOUSE_DOWN
+dùng stopDrag() : dùng cho đối tượng với sự kiện MOUSE_UP
code tổng quát như sau:
function start_mc(e:Event):void{
e.target.startDrag();
}
function stop_mc(e:Event):void{
e.target.stopDrag();
}
mc.addEventListener(MouseEvent.MOUSE_DOWN,start_mc);
mc.addEventListener(MouseEvent.MOUSE_UP,stop_mc);
-Tải code soucre ở đây: http://www.mediafire.com/?czra8eahhk7np7u