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.
如何以及何时使用obj.addEventListener(Event.ENTER_FRAME,fun)进入帧事件?我不明白如何在 displayobjects 或 UIcomponents 上使用它?
obj.addEventListener(Event.ENTER_FRAME,fun)
每次渲染舞台时都会触发 ENTER_FRAME。例如,如果您想在舞台上移动一个对象,您可以执行以下操作:
// Your Sprite mySprite.addEventListener(Event.ENTER_FRAME, moveIt); function moveIt(e:Event):void{ e.currentTarget.x += 1; }
只是一个小例子。