Listen to the Joystiq Podcast (because your ears can't read)

Try Catch…Finally

I’m sure YOUR code is always perfect, that YOUR functions that expect strings only ever get passed strings and that nothing every fails in YOUR world, in MY world, stuff happens..constantly, and when it does I’m pretty happy to have something like Try Catch, if your unaware of TC, it’s a very handy thing indeed.

simply:
The try…catch…finally statement provides a way to handle some or all of the possible errors that may occur in a given block of code, while still running code.

Consider the following simple example:

function myFunction():Void {
   throw new Error(”Some error”);
 }

 try {
   myFunction();
 }
 catch(errObject:Error) {
   trace(errObject.message);
 }

kind of a silly example, but it illustrates the concept, of course the ‘myFunction is going to throw the error every time, and when it does the error is ‘caught’ by the catch portion of the the try command that called ‘myfunction’ —

For a much more detailed explaination — stop by Joey Lotts article on the subject.


News
Macromedia (141)
Innovation (164)
Merger (41)
Releases (65)
WIN Business (24)
Events
MAX (26)
FlashForward (8)
MMUGs (16)
Webinars (4)
Learning
ActionScript (49)
Designer Certification (5)
Developer Certification (6)
Ideas (163)
Links (83)
Samples (57)
Tips and Tricks (98)
Tutorials (45)
Design & Development
Accessibility (14)
Ad Design (27)
Art (94)
Components (6)
Extensions (17)
Games (65)
Rich Internet Applications (99)
Sound (38)
Video (65)
Web Standards (33)
Software
Flash 8 (103)
Flash MX2004 (92)
Flash Paper 2 (3)
Flash Player 8 (55)
Flash MX2004 Professional (44)
Flash Lite (24)
Flash Platform (91)
Flash Remoting (3)
Flash Communications Server MX (8)
Flash Video (24)
Flash Paper (3)
Macromedia Contribute (2)
Macromedia Flex (8)
8Ball (15)
Maelstrom (19)
Software Updates (34)
Beta (22)
Bugs (14)
Studio 8 (25)

RESOURCES

RSS NEWSFEEDS

Powered by Blogsmith

Other Weblogs Inc. Network blogs you might be interested in: