throw Error in a function : Throw : Statement Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Statement » Throw »

 

throw Error in a function


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){


        var sUsername:String = tUsername.text; 
        
        try {
          checkUsername(sUsername);
        }
        catch (erObject:Error) {
          trace("An error was thrown.");
        }
    }
    function checkUsername(sUsernameParam:String) {
      if(sUsernameParam == "") {
        throw new Error();
      }
    
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Statement
» Throw