Hi, yup either public function myBall( value:int ):Ball { var ball:Ball
try{ //my code goes here..... return ball; } catch (e:TypeError ){ trace("Whoops"); } return null; } or public function myBall( value:int ):Ball { var ball:Ball = null; try{ //my code goes here..... } catch (e:TypeError ){ } return ball; } There are more possibilities, some of which are better practice than others, but in such a small method, I wouldn't make to much of a fuss about it. regards, JC On Sat, May 9, 2009 at 3:22 AM, ACE Flash <acefl...@gmail.com> wrote: > Hi there, > > I am trying to add try block in my code, how can I deal it with return > function? > > If the code without any problems, I'd like to return "ball" , otherwise I'd > like to EXIT or return null. > > Thanks > > ------------------------- > > public function myBall( value:int ):Ball > { > var ball:Ball > > try{ > > //my code goes here..... > return ball; > } catch (e:TypeError ){ > > } > > // shall I add => return null here? > } > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders