3 Replies Latest reply on Mar 10, 2008 4:13 PM by Garyl Woolworth

    Turn errors off?

    jefflemon Level 1
      My app has a few erros when viewed with flash debugger, is there anyway to turn these off without fixing them as you can with php etc?
        • 1. Re: Turn errors off?
          ntsiii Level 3
          Do you mean "warnings? "Errors" will stop the app from working.

          I am not certain, but I suspect that if you compile a "release" version, the warnings will not be visible.

          Tracy
          • 2. Re: Turn errors off?
            ntsiii Level 3
            Do you mean "warnings? "Errors" will stop the app from working.

            I am not certain, but I suspect that if you compile a "release" version, the warnings will not be visible.

            Tracy
            • 3. Re: Turn errors off?
              Garyl Woolworth Level 1
              I assume that Jeff is talking about "Runtime Errors" where Flex gives you the benefit of the doubt with the code you have typed that something will exist when it needs it at that point of time. As far as my knowledge goes there is no way to turn "off" runtime errors as the debug version of flash is essentially made to notify the developer he has made a mistake, most end users do not have this version of flash player installed. There are really only two ways to fix a runtime error either A) Fix the error so that flex is happy again (obvious). or B) Wrap the code that throws the runtime error inside of a try / catch statement with no catch handler, example as follows.

              import mx.controls.Alert;

              try {
              Alert.show(var1, "Notice");
              } catch (error:Error){
              // do nothing
              }

              This would throw a runtime error because var1 was not defined. It tried to Alert the variable but failed, so it switched to the catch statement, now it's up to you to do what you want with the error whether that be trace it, alert it, or nothing at all. I wouldn't recommend this coding standard very often but there are times when your not 100% sure something is going to be there and you don't want it to display a massive RTE to the user. My advice is try to write your code to where this is not needed.