Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个“拖动项目”和一些“放置目标”,所以我想在“拖动项目”拖动时突出显示放置目标,因此需要跟踪鼠标位置或监听鼠标移动事件。我尝试订阅 ENTER_FRAME 事件并进行命中测试,但想知道这种情况有什么解决方案。谢谢你。
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); function onMouseMove(e:MouseEvent):void { //Do your thing here e.updateAfterEvent(); }
请注意,如果您正在侦听开始/停止拖动,那么您应该在开始/停止事件发生时添加/删除 MOUSE_MOVE 侦听器。