on (press) {
startDrag("class", false);
XXXXX=this._x;
YYYYY=this._y;
trace(xxxxx+'' ''+yyyyy)
}
on (release, releaseOutside) {
stopDrag();
trace(this._x+'' ''+this._y)
if ((this._x>=65) && (this._x<=190) && (this._y>=24) && (this._y<=145)){
this._xscale=40;
this._yscale=40;
}else{
this._x=XXXXX;
this._y=YYYYY;
}
}
被拖动的物体是一个在场景中的电影剪辑。
我将this改成了“class"就OK了。看来可以是按钮哦。
---------------------------------------------------------------
on (press) {
startDrag("class", false); //開始拖動class,不用對齊到鼠標
XXXXX=this._x; //變量XXXX保存原座標,為什麽不放到startdrag之前呢
YYYYY=this._y; //變量yyyy保存原座標
trace(xxxxx+'' ''+yyyyy) //看一下兩個座標的值
}
on (release, releaseOutside) {
stopDrag(); //停止拖動後...
trace(this._x+'' ''+this._y) //看一下現在的座標
if ((this._x>=65) && (this._x<=190) && (this._y>=24) && (this._y<=145)){
//如果座標在指定範圍中的話...
this._xscale=40; //橫向縮放40%
this._yscale=40; //縱向縮放40%
}else{
//如果不在指定範圍中的話
this._x=XXXXX; //設當前橫座標是拖動之前的值(之前已經保存在變量XXXX中)
this._y=YYYYY; //設當前縱座標是拖動之前的值(之前已經保存在變量YYYY中)
}
}
startDrag("class", false);
XXXXX=this._x;
YYYYY=this._y;
trace(xxxxx+'' ''+yyyyy)
}
on (release, releaseOutside) {
stopDrag();
trace(this._x+'' ''+this._y)
if ((this._x>=65) && (this._x<=190) && (this._y>=24) && (this._y<=145)){
this._xscale=40;
this._yscale=40;
}else{
this._x=XXXXX;
this._y=YYYYY;
}
}
被拖动的物体是一个在场景中的电影剪辑。
我将this改成了“class"就OK了。看来可以是按钮哦。
---------------------------------------------------------------
on (press) {
startDrag("class", false); //開始拖動class,不用對齊到鼠標
XXXXX=this._x; //變量XXXX保存原座標,為什麽不放到startdrag之前呢
YYYYY=this._y; //變量yyyy保存原座標
trace(xxxxx+'' ''+yyyyy) //看一下兩個座標的值
}
on (release, releaseOutside) {
stopDrag(); //停止拖動後...
trace(this._x+'' ''+this._y) //看一下現在的座標
if ((this._x>=65) && (this._x<=190) && (this._y>=24) && (this._y<=145)){
//如果座標在指定範圍中的話...
this._xscale=40; //橫向縮放40%
this._yscale=40; //縱向縮放40%
}else{
//如果不在指定範圍中的話
this._x=XXXXX; //設當前橫座標是拖動之前的值(之前已經保存在變量XXXX中)
this._y=YYYYY; //設當前縱座標是拖動之前的值(之前已經保存在變量YYYY中)
}
}
回复Comments
作者:
{commentrecontent}