Flash中限定自由区域的拖拽
2006-07-31 17:17
211 查看
场景中有一个被拖拽的mc和一个自由区域的mc,分别用startDrag和hitTest。
先拖拽,再用鼠标对自由区域的mc进行true的hitTest,然后记录位置,最后写回。
具体代码如下:
function update() {
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() {
drag = true;
this.startDrag();
};
handle_mc.onRelease = handle_mc.onReleaseOutside = function () {
drag = false;
stopDrag();
update();
};
onMouseMove = function () {
if (drag) {
update();
}
};
var drag, temp_x, temp_y;
源文件下载
先拖拽,再用鼠标对自由区域的mc进行true的hitTest,然后记录位置,最后写回。
具体代码如下:
function update() {
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() {
drag = true;
this.startDrag();
};
handle_mc.onRelease = handle_mc.onReleaseOutside = function () {
drag = false;
stopDrag();
update();
};
onMouseMove = function () {
if (drag) {
update();
}
};
var drag, temp_x, temp_y;
源文件下载
相关文章推荐
- draggable()拖拽时限制移动区域
- 一个可拖拽,移动,自由组合子控件的视图控件,让开发更简单
- UnityGUI:在限定区域中自动滚动文字
- jQuery使用drag效果实现自由拖拽div
- new限定区域分配内存
- Flash地图控件AnyMap中地图区域标签的使用
- 用Flash 的 AS代码来编写一个蝌蚪自由摆尾游动的动画
- php实现在限定区域里自动调整字体大小的类实例
- C++ new限定区域分配内存
- Qt 之 简单截图功能(三)实现可拖拽选中区域
- 如何在freescale banked区域操作一个变量(RAM, EEPROM, FLASH)
- 【NGUI】限制UIDargObject的拖拽区域(技能双摇杆的实现)
- Android DIY之路 (三) 手绘 仅在限定区域留下痕迹 并再现这一过程
- [绍棠] iOS UITableView 的坑:isDragging 属性无效, tableView是拖拽还是自由滑动区分
- 基于tetgen对曲面分隔的box区域做限定四面体剖分
- 如何给flash 分两个FAT区域
- 一个可以自由定制外观、支持拖拽消除的 MaterialDesign 风格 Android BadgeView
- 一款可以限定选择区域的日期控件
- 安卓实现自由拖拽view的几种方式
- jquery.ui.draggable中文文档jquery 自由拖拽类~study~