Actionscript 3 请将AS2 por转换为AS3
我想你是在找AS3版本的?像这样的方法应该会奏效:Actionscript 3 请将AS2 por转换为AS3,actionscript-3,actionscript-2,Actionscript 3,Actionscript 2,我想你是在找AS3版本的?像这样的方法应该会奏效: oranja.onPress = function(){ this.startDrag(true); } oranja.onRelease = function(){ this.stopDrag(); if(this.hitTest(this._parent.trash)){ trace("trash"); this.unloadMovie();
oranja.onPress = function(){
this.startDrag(true);
}
oranja.onRelease = function(){
this.stopDrag();
if(this.hitTest(this._parent.trash)){
trace("trash");
this.unloadMovie();
} else {
trace("no trash");
}
}
您可能应该用
e.target
或e.currentTarget
替换\u onPress()
和\u onRelease()
中的oranja
调用。您真的希望有人为您这样做吗?你为什么不发布问题的详细信息,以便有人能帮助你从中学习。@mdm英语可能不是这里的母语。@午餐317我很感激,我不需要英语解释,只是人们不会在没有礼貌的情况下发布代码并期望其他人做事情,比如描述问题可能是什么,或者他们已经试图解决问题了——不管是什么语言,请参考oranja.parent.getChildByName(“垃圾”)
到oranja.parent.trash
oranja.addEventListener( MouseEvent.MOUSE_DOWN, this._onPress );
oranja.addEventListener( MouseEvent.MOUSE_UP, this._onRelease );
// called when we mouse down on the oranja clip
private function _onPress( e:MouseEvent ):void
{
oranja.startDrag( true )
}
// called when we mouse up on the oranja clip
private function _onRelease( e:MouseEvent ):void
{
oranja.stopDrag();
if( oranja.hitTest( oranja.parent.trash ) )
{
trace( "trash" );
// remove the event listeners
oranja.removeEventListener( MouseEvent.MOUSE_DOWN, this._onPress );
oranja.removeEventListener( MouseEvent.MOUSE_UP, this._onRelease );
// remove the oranja clip
oranja.parent.removeChild( oranja );
oranja = null;
}
else
trace( "not trash" );
}