`
hgfghw5
  • 浏览: 48394 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
最近访客 更多访客>>
szk
社区版块
存档分类
最新评论

Flash限定自由区域的拖拽教程

阅读更多

场景中有一个被拖拽的mc和一个自由区域的mc,分别用startDrag和hitTest。
先拖拽,再用鼠标对自由区域的mc进行true的hitTest,然后记录位置,最后写回。
具体代码如下:
 
function update()
{
    handle_mc._x = _xmouse;
    handle_mc._y = _ymouse;
    if (area_mc.hitTest(_xmouse, _ymouse, true)) {
        temp_x = _xmouse;
        temp_y = _ymouse;
    } else {
        handle_mc._x = temp_x;
        handle_mc._y = temp_y;
    }
}
handle_mc.onPress = function()
{
   
本文转自:http://www.5uflash.com/flashjiaocheng/Flashyingyongkaifa/961.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics