Flash Player 8.5 supports a try/catch methodology for handling errors in ActionScript. That means you can write code that can intelligently deal with certain error types should they occur. While you cannot handle syntax errors (the .swf won't even compile in that case), you can handle most other error types, such as missing or invalid data. The benefit is that you can attempt to resolve the situation programmatically.
Use a throw statement to throw an error when it is detected. Place any potentially error-generating code within a try block, and then have one or more corresponding catch blocks to handle possible errors.
An example situation:
Suppose we are creating an email application in flash actionscript 3.0 using smtp. We have
We need the above three as input from user, the first input "To" to whom we are going to mail is mandatory list. so if user forgot to type any mail id or if the typed mail id is not valid then we need to throw an error and exception, must handle error in actionscript.
There are two basic parts involved in working with errors in ActionScript: throwing the error and catching the error. There are several errors, which are thrown automatically by the player, such as IllegalOperationError, MemoryError, and ScriptTimeoutError.
For more of Handling error in actionscript
Use a throw statement to throw an error when it is detected. Place any potentially error-generating code within a try block, and then have one or more corresponding catch blocks to handle possible errors.
An example situation:
Suppose we are creating an email application in flash actionscript 3.0 using smtp. We have
- To
- Subject
- messase box
We need the above three as input from user, the first input "To" to whom we are going to mail is mandatory list. so if user forgot to type any mail id or if the typed mail id is not valid then we need to throw an error and exception, must handle error in actionscript.
There are two basic parts involved in working with errors in ActionScript: throwing the error and catching the error. There are several errors, which are thrown automatically by the player, such as IllegalOperationError, MemoryError, and ScriptTimeoutError.
For more of Handling error in actionscript
0 comments:
Post a Comment