#22006/9/25 8:40:45
控制图片的LOC,只是算法问题,我做了一个简单的示例,还有很多东西没有考虑,比如,鼠标移动与图片移动的比例、鼠标超出图片或剧场后释放时的控制、图片边界的限制、鼠标指针的形状变化.....等等。你做个参考吧。
下面的代码放在电影脚本中:
global canMove
on startMovie
canMove = false
end
下面的代码放在图片脚本中:
global canMove,oldMouseH,oldMouseV
on mouseDown me
oldMouseH = the mouseH
oldMouseV = the mouseV
canMove = true
endon mouseUp me
canMove = false
endon exitFrame me
curMouseH = the mouseH
curMouseV = the mouseV
if canMove = true then
sprite(me.spriteNum).locH = sprite(me.spriteNum).loch + curMouseH - oldMouseH
sprite(me.spriteNum).locV = sprite(me.spriteNum).locV + curMouseV - oldMouseV
end if
oldMouseH = curMouseH
oldMouseV = curMouseV
end
闭起眼睛看人生