如何使用的DropTarget在AS3?如何使用、DropTarget

2023-09-08 15:38:20 作者:微笑ヽ诠释①切

我需要将其转换AS2 code到AS3。

I need to convert this AS2 code to AS3.

on (release)
 {

    stopDrag();
    this.MOR1.zzz.gotoAndStop(1);

    if (this._droptarget == "/lcd5") {

        this.MOR1.zzz.shekl.gotoAndStop(1);
        _root.nor.gotoAndStop(3);
    } else {

        this.MOR1.zzz.shekl.gotoAndStop(4);
        _root.nor.gotoAndStop(2);
    }

    if (this._droptarget == "/lcd1") {

        setProperty(this, _x, -731.7);
        setProperty(this, _y, 626.4);
    }
}

请帮助我。谢谢你...

Please help me. Thank you...

推荐答案

首先,你将需要开始使用事件侦听器。

First off, you're going to need to start using event listeners.

现在的主要问题。 DropTarget的似乎停止更新工作最近。我不完全知道为什么。

Now to the main issue. dropTarget appeared to stop working in an update recently. I'm not entirely sure why.

因此​​,你将需要改变做法。相反的DropTarget,请使用以下任一...

Thus, you're going to need to change approach. Instead of droptarget, use one of the following...

的DisplayObject hitTestPoint() 的DisplayObject hitTestObject()(注意,this一个值匹配 对象的边框,而不是对象的实际 形状) 位图则hitTest()。 DisplayObject hitTestPoint() DisplayObject hitTestObject() (beware, this one matches to the bounding box of the object, NOT to the object's actual shape) Bitmap hitTest().

我建议hitTestPoint()出了三个,但最终的决定是由你。

I recommend hitTestPoint() out of the three, but the final decision is up to you.