Я думаю, что вы ищете эту версию для AS3?Что-то вроде этого должно работать:
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" );
}
Возможно, вы должны заменить oranja
вызовы в _onPress()
и _onRelease()
на e.target
или e.currentTarget