how to use droptarget in AS3?

筅森魡賤 提交于 2019-12-13 08:26:06

问题


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...


回答1:


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

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

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

  • DisplayObject hitTestPoint()
  • DisplayObject hitTestObject() (beware, this one matches to the bounding box of the object, NOT to the object's actual shape)
  • Bitmap hitTest().

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



来源:https://stackoverflow.com/questions/21071984/how-to-use-droptarget-in-as3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!