How to implement Custom Events?

前端 未结 2 1710
一个人的身影
一个人的身影 2020-12-22 06:28

How do I correctly implement custom events? I thought the following should work, but I never receive CustomEvent.READY in the main Model

package mvc
{
    im         


        
2条回答
  •  忘掉有多难
    2020-12-22 06:57

    I don't really see anything wrong with the code. Just to test, try adding this statement at the end of initWorld() method:

    _worldModel.dispatchEvent(new Event(CustomEvent.READY));
    

    If your update() method is called, that would indicate that your existing dispatchEvent() method isn't being called.

提交回复
热议问题