代码详解
图片1语句
on (press) {
_root.p1.startDrag( 1 );
x0 = getproperty(_root.hitp1,_x);//获取HITP1的坐标位置X;
y0 = getproperty(_root.hitp1,_y);//获取HITP1的坐标位置Y;
x1=_root.p1._x;
y1=_root.p1._y;
}
on (release) {
_root.p1.stopDrag();
if (_root.p1.hitTest(x0,y0,0)) {
_root.p1._x=x0;
_root.p1._y=y0;
_root.info = "图片放置正确!";
} else {
_root.p1._x=x1;
_root.p1._y=y1;
_root.info = "图片放置位置不对!再试一试。";
}
}//发生重叠时条件以及图片位置的确定;动态文本的提示;
以下同理;
图片2语句
on (press) {
_root.p2.startDrag( 1 );
x0 = getproperty(_root.hitp2,_x);
y0 = getproperty(_root.hitp2,_y);
x1=_root.p2._x;
y1=_root.p2._y;
}
on (release) {
_root.p2.stopDrag();
if (_root.p2.hitTest(x0,y0,0)) {
_root.p2._x=x0;
_root.p2._y=y0;
_root.info = "图片放置正确!";
} else {
_root.p2._x=x1;
_root.p2._y=y1;
_root.info = "图片放置位置不对!再试一试。";
}
}
图片3语句
on (press) {
_root.p3.startDrag( 1 );
x0 = getproperty(_root.hitp3,_x);
y0 = getproperty(_root.hitp3,_y);
x1=_root.p3._x;
y1=_root.p3._y;
}
on (release) {
_root.p3.stopDrag();
if (_root.p3.hitTest(x0,y0,0)) {
_root.p3._x=x0;
_root.p3._y=y0;
_root.info = "图片放置正确!";
} else {
_root.p3._x=x1;
_root.p3._y=y1;
_root.info = "图片放置位置不对!再试一试。";
}
}
图片4语句
on (press) {
_root.p4.startDrag( 1 );
x0 = getproperty(_root.hitp4,_x);
y0 = getproperty(_root.hitp4,_y);
x1=_root.p4._x;
y1=_root.p4._y;
}
on (release) {
_root.p4.stopDrag();
if (_root.p4.hitTest(x0,y0,0)) {
_root.p4._x=x0;
_root.p4._y=y0;
_root.info = "图片放置正确!";
} else {
_root.p4._x=x1;
_root.p4._y=y1;
_root.info = "图片放置位置不对!再试一试。";
}
}