3 Replies Latest reply on Jul 11, 2010 10:56 AM by kglad



      theres a piece of a code on shootorial (a tutorial for making a game) that is


      should it be the same thing write


      well, obviously it isnt the same thing because the game doesnt work if i change it, but why?

        • 1. Re: shootorial
          kglad Adobe Community Professional & MVP

          you're calling that function when that code executes and not when that object is pressed.  try:



          • 2. Re: shootorial
            killermelga2 Level 1

            that way the menu just disapears, and the game doesnt reset

            I'll explain better the situation


            this is the newGame function


            function newGame()


            the function is inside my main ship class, so the this._visible, refers to the ship


            I want that when i press a button the newGame function is called



            with the code i currently have, it works fine, with my second code, nothing happens, with the code your provided, the gameOverMenu disappears but the game doesnt reset

            • 3. Re: shootorial
              kglad Adobe Community Professional & MVP

              the code i suggested works to call that function when your button is pressed.  that's what you asked for.


              the fact that you're now out of scope of when that button is pressed is a different issue:  "this" will refer to the pressed button when called by the code you wanted help with.