Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 请将AS2 por转换为AS3_Actionscript 3_Actionscript 2 - Fatal编程技术网

Actionscript 3 请将AS2 por转换为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();

我想你是在找AS3版本的?像这样的方法应该会奏效:

   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" );
}