ActionScript 3 开始拖动/精灵怪异
我有一个匹配游戏,将单词拖放到定义中。这个游戏的流程是,当你回答完后,点击一个按钮,然后游戏会删除正确的答案并重新显示错误的答案。
到目前为止,这是有效的,但无效的是,在答案部分之后并且我输入了错误的单词/定义,拖动“视觉上”不起作用。当我在调试中运行时,拖动正在触发,但对象不会在屏幕上移动。它也没有击中任何目标(这似乎很明显)。我从不破坏该对象。所以据我所知,鼠标事件应该仍然有效。
示例可以在这里找到: http://www.pandabrand.net/xmldisplay.html
谢谢。 -fw
I have a match game, drag and drop a word to a definition. The flow of this game is that after you have answered you click a button and then the game removes the right answers and redisplays the wrong ones.
So far that works, what doesn't is that after the answer portion and I put the wrong words/definitions the drag doesn't "visually" work. when i run in debug the drag is firing, but the object doesn't move on the screen. it also doesn't hit any target (which seems obvious). I never destroy the object.So As far as I can see the mouse events should still be working.
example can be found here:
http://www.pandabrand.net/xmldisplay.html
thanks.
-fw
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来每个可拖动对象的某些设置都没有被重置。与其在这里回收,不如将错误的答案存储在数组中,销毁旧对象(确保删除所有侦听器),然后为新场景重新创建所有内容。
Looks like some settings on each of those draggable objects aren't being reset. Instead of recycling here, maybe store the wrong answers in an array, destroy the old objects (making sure to remove all listeners) and then recreate everything for the new scene.
您可以尝试确保在要拖动的影片剪辑之上没有其他可能会窃取您的事件的影片剪辑。
您还可以尝试防止影片剪辑的子级窃取事件,如下所示:
whatever_mc.mouseChildren = false;
You can try making sure there is not another movie clip on top of the one you want to drag that may be stealing your event.
You can also try to prevent children of your movie clip from stealing events as follows:
whatever_mc.mouseChildren = false;