Subscribe to Tutorial Feed

Flash and PHP Bible

The Flash and PHP Bible has been released! The book can be found on Amazon or wherever fine books are sold in your area.

The Flash and PHP Bible has a forum for quick support.

Scriptplayground » tutorials » as » Create a custom error in ActionScript 3

Create a custom error in ActionScript 3

Here is some simple code to create a custom error.

The code to present or "throw" a custom error is fairly simple. You start off by making a new instance "instantiating" the Error Class which is part of the standard AS3 library.

This class takes a string as an argument, that is displayed to the debug box and screen if in debug mode.

throw new Error("Sorry, I just have to present this great error now!");

Note: Note, this will create a fatal error and will display a dialog at runtime if the debug player is used.

Thats all there is to creating a custom error

Follow Scriptplayground on Twitter (@scriptplay)

Comments: Create a custom error in ActionScript 3

 FX77  Tue Nov 27, 2007 2:50 pm  
:D Nice! Short and sweet! But what if I want to TOSS it rather then THROW a new error? :P
Add a comment
The ability to add new comments has been disabled in this archived version.

Loading
Main | Tutorials | Articles