AS3.0函数定义的方法

在AS3.0中函数的定义有两种方法:

函数语句定义法:

function 函数名(参数1:参数类型,参数2:参数类型):返回值类型{

  函数折行的语句

}

function testAdd(a:int,b:int):int
{
      return a+b;
}

 

函数表达式定义法:就是把整个函数以一个变量的形式来定义。

var 函数名:Function = function(参数1:参数类型,参数2:参数类型):返回值类型{

  函数折行的语句

}

var testAdd:Function = function(a:int,b:int):int{
    return a+b;    
}

 

posted @ 2013-07-11 22:33  yexingwen  阅读(2398)  评论(0编辑  收藏  举报