Skip to main content
Anonymous507
Known Participant
April 22, 2010
Answered

what is try..catch..finally and its purpose ?

  • April 22, 2010
  • 1 reply
  • 641 views

hi,

I am new to AS 3.0. Can any body explain me about how to use try..catch..finally and its purpose

any help or tutorials pls.

Thanks in Advance,

@5807549

This topic has been closed for replies.
Correct answer kglad

it's used to encode something that might not work and that when it fails instead of having an unhandled error, the error is handled in either the catch branch(es) or the finally branch.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
April 22, 2010

it's used to encode something that might not work and that when it fails instead of having an unhandled error, the error is handled in either the catch branch(es) or the finally branch.

Anonymous507
Known Participant
April 22, 2010

Thanks for your reply

can you provide me any examples for try catch

kglad
Community Expert
Community Expert
April 22, 2010

var sp:Sprite=new Sprite();

var c:Sprite=new Sprite();

try{
    sp.addChildAt(c,100);
} catch(e:Error){
    trace("not enough children!")
}