如何使用的DropTarget在AS3? [英] how to use droptarget in AS3?

查看:170
本文介绍了如何使用的DropTarget在AS3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将其转换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...

推荐答案

首先,你将需要开始使用<一个href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e54.html"相对=nofollow>事件侦听器。

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

  • <一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#hitTestPoint%28%29"相对=nofollow>的DisplayObject hitTestPoint()
  • <一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#hitTestObject%28%29"相对=nofollow>的DisplayObject hitTestObject()(注意,<一个href="http://stackoverflow.com/questions/21069020/collision-detection-in-flash-functionalities-hittestobject/21069434#21069434">this一个值匹配 对象的边框,而不是对象的实际 形状)
  • <一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#hitTest%28%29"相对=nofollow>位图则hitTest()。

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

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

这篇关于如何使用的DropTarget在AS3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆