Search code examples
flashactionscript

AS3 Event.ENTER_FRAME tips for game developer


Im new to flash game developing and currently i am developing my first game. RPG Action Game. I`m having a problem with ENTER_FRAME Event.

I currently have 3 ENTER_FRAME Events, from my document class, hero and ground. Each time I run the application, the flash player crashes.

What would be a good approach with this problem? I am thinking to have one main enterframe event which controls everything and change my design pattern.. T_T.


Solution

  • In your document class you could have:

    addEventListener(Event.ENTER_FRAME, onEnter);
    private function onEnter(e:Event):void
    {
        hero.update();
        ground.update();
        //do other stuff    
    }