2 Replies Latest reply on Aug 24, 2009 8:40 AM by paul.williams

    does the code bellow try/catch/finally will be executed in case of exception? REFdn6025108709

    DennisTh

      Hello guys

       

      I have a question about the AS3.0 and the try/catch/finally block. When an exception in thrown an exception in a try block, will the runtimer continue to execute the code next of the try/catch/finally block?

       

      For instance, suppose the follow code:

       

      public function attackEnemy (enemy:SpaceShip):void {

        try {

          setCurrentTarget(enemy);

          fireOnCurrentTarget( );

        } finally {

          setCurrentTarget(null);

        }

        trace(“attach is finished”);

      }

      Will the “trace” call, be executed is the case of an exception?

      If yes, what is the point of finally block?

       

      Kind regards

      Dennis