有没有AS高手,帮我把这短2.0代码改成3.0的?高分悬赏,如果能用至少追加100分!
functionaddEvent(){varcount=9;trace("#######count="+count+","+this);varj=1;while(j<=c...
function addEvent()
{
var count = 9;
trace ("#######count=" + count + " , " + this);
var j = 1;
while (j <= count)
{
eval("t_" + j).onRelease = targetMouseup;
eval("t_" + j).onReleaseOutside = targetMouseup;
eval("t_" + j).onPress = targetMousedown;
++j;
} // end while
} // End of the function
function targetMousedown()
{
this.swapDepths(this._parent.getNextHighestDepth());
oldPostion.x = this._x;
oldPostion.y = this._y;
this.startDrag();
} // End of the function
function targetMouseup()
{
this.stopDrag();
var _loc5 = this._name;
var _loc8 = _loc5.substr(_loc5.indexOf("_") + 1);
var _loc3 = this._parent["s_" + _loc8];
var _loc7 = this.hitTest(_loc3);
var _loc4 = new flash.geom.Point(_loc3._x, _loc3._y);
_loc3._parent.localToGlobal(_loc4);
var _loc6 = false;
if (_loc4.x <= _root._xmouse && _loc4.x + _loc3._width > _root._xmouse && _loc4.y <= _root._ymouse && _loc4.y + _loc3._height > _root._ymouse)
{
_loc6 = true;
} // end if
if (_loc7 && _loc6)
{
delete this.onRelease;
delete this.onReleaseOutside;
delete this.onPress;
this._x = _loc3._x;
this._y = _loc3._y;
++numWork;
if (numWork >= 9)
{
_root.gotoAndPlay("show1");
} // end if
}
else
{
this._x = oldPostion.x;
this._y = oldPostion.y;
} // end else if
} // End of the function
stop ();
addEvent();
var oldPostion = new flash.geom.Point();
var numWork = 0; 展开
{
var count = 9;
trace ("#######count=" + count + " , " + this);
var j = 1;
while (j <= count)
{
eval("t_" + j).onRelease = targetMouseup;
eval("t_" + j).onReleaseOutside = targetMouseup;
eval("t_" + j).onPress = targetMousedown;
++j;
} // end while
} // End of the function
function targetMousedown()
{
this.swapDepths(this._parent.getNextHighestDepth());
oldPostion.x = this._x;
oldPostion.y = this._y;
this.startDrag();
} // End of the function
function targetMouseup()
{
this.stopDrag();
var _loc5 = this._name;
var _loc8 = _loc5.substr(_loc5.indexOf("_") + 1);
var _loc3 = this._parent["s_" + _loc8];
var _loc7 = this.hitTest(_loc3);
var _loc4 = new flash.geom.Point(_loc3._x, _loc3._y);
_loc3._parent.localToGlobal(_loc4);
var _loc6 = false;
if (_loc4.x <= _root._xmouse && _loc4.x + _loc3._width > _root._xmouse && _loc4.y <= _root._ymouse && _loc4.y + _loc3._height > _root._ymouse)
{
_loc6 = true;
} // end if
if (_loc7 && _loc6)
{
delete this.onRelease;
delete this.onReleaseOutside;
delete this.onPress;
this._x = _loc3._x;
this._y = _loc3._y;
++numWork;
if (numWork >= 9)
{
_root.gotoAndPlay("show1");
} // end if
}
else
{
this._x = oldPostion.x;
this._y = oldPostion.y;
} // end else if
} // End of the function
stop ();
addEvent();
var oldPostion = new flash.geom.Point();
var numWork = 0; 展开
展开全部
function addEvent()
{
var count:int = 9;
var j:int = 1;
while (j <= count)
{
this["t_" + j].addEventListener(MouseEvent.CLICK,targetMouseup);
this["t_" + j].addEventListener(MouseEvent.MOUSE_UP,targetMouseup);
this["t_" + j].addEventListener(MouseEvent.MOUSE_DOWN,targetMousedown);
++j;
} // end while
} // End of the function
function targetMousedown(e:MouseEvent)
{
e.target.parent.setChildIndex(e.target,this.parent.numChildren-1)
oldPostion.x = e.target.x;
oldPostion.y = e.target.y;
e.target.startDrag(false);
} // End of the function
function targetMouseup(e:MouseEvent)
{
e.target..stopDrag();
var _loc5:String = e.target._name;
var _loc8:String = _loc5.substr(_loc5.indexOf("_") + 1);
var _loc3:MovieClip = e.target.parent["s_" + _loc8];
var _loc7:Boolean = this.hitTest(_loc3);
var _loc4:Point = new Point(_loc3._x, _loc3._y);
_loc3.parent.localToGlobal(_loc4);
var _loc6:Boolean = false;
if (_loc4.x <= this.mouseX && _loc4.x + _loc3.width > this.mouseX && _loc4.y <= this.mouseY && _loc4.y + _loc3._height > this.mouseY)
{
_loc6 = true;
} // end if
if (_loc7 && _loc6)
{
e.target.removeEventListener(MouseEvent.CLICK,targetMouseup);
e.target.removeEventListener(MouseEvent.MOUSE_UP,targetMouseup);
e.target.removeEventListener(MouseEvent.MOUSE_DOWN,targetMousedown);
e.target.x = _loc3.x;
e.target.y = _loc3.y;
++numWork;
if (numWork >= 9)
{
this.gotoAndPlay("show1");
} // end if
}
else
{
e.target.x = oldPostion.x;
e.target.y = oldPostion.y;
} // end else if
} // End of the function
stop ();
addEvent();
var oldPostion = new Point(0,0);
var numWork:int = 0;
从你的代码改过来只能改成这样,我也没你的源文件,所以做不了测试。你可以先试试,不行再叫我改!
{
var count:int = 9;
var j:int = 1;
while (j <= count)
{
this["t_" + j].addEventListener(MouseEvent.CLICK,targetMouseup);
this["t_" + j].addEventListener(MouseEvent.MOUSE_UP,targetMouseup);
this["t_" + j].addEventListener(MouseEvent.MOUSE_DOWN,targetMousedown);
++j;
} // end while
} // End of the function
function targetMousedown(e:MouseEvent)
{
e.target.parent.setChildIndex(e.target,this.parent.numChildren-1)
oldPostion.x = e.target.x;
oldPostion.y = e.target.y;
e.target.startDrag(false);
} // End of the function
function targetMouseup(e:MouseEvent)
{
e.target..stopDrag();
var _loc5:String = e.target._name;
var _loc8:String = _loc5.substr(_loc5.indexOf("_") + 1);
var _loc3:MovieClip = e.target.parent["s_" + _loc8];
var _loc7:Boolean = this.hitTest(_loc3);
var _loc4:Point = new Point(_loc3._x, _loc3._y);
_loc3.parent.localToGlobal(_loc4);
var _loc6:Boolean = false;
if (_loc4.x <= this.mouseX && _loc4.x + _loc3.width > this.mouseX && _loc4.y <= this.mouseY && _loc4.y + _loc3._height > this.mouseY)
{
_loc6 = true;
} // end if
if (_loc7 && _loc6)
{
e.target.removeEventListener(MouseEvent.CLICK,targetMouseup);
e.target.removeEventListener(MouseEvent.MOUSE_UP,targetMouseup);
e.target.removeEventListener(MouseEvent.MOUSE_DOWN,targetMousedown);
e.target.x = _loc3.x;
e.target.y = _loc3.y;
++numWork;
if (numWork >= 9)
{
this.gotoAndPlay("show1");
} // end if
}
else
{
e.target.x = oldPostion.x;
e.target.y = oldPostion.y;
} // end else if
} // End of the function
stop ();
addEvent();
var oldPostion = new Point(0,0);
var numWork:int = 0;
从你的代码改过来只能改成这样,我也没你的源文件,所以做不了测试。你可以先试试,不行再叫我改!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询