您的位置:首页 > 编程语言

函数定义和调用的代码实例

2010-04-06 18:27 316 查看
1 package
2 {
3 import flash.display.Sprite;
4 import flash.events.MouseEvent;
5
6 public class FunctionExample extends Sprite
7 {
8 /*************************************
9 * 构造函数
10 * ************************************/
11 public function FunctionExample()
12 {
13 // 调用函数
14 var fullName:String = GetFullName("Jim", "Green");
15
16 // 输出
17 trace("全名是:" + fullName);
18 }
19
20 /*************************************
21 * 创建获取全名的函数
22 * ************************************/
23 private function GetFullName(fName:String, lName:String):String
24 {
25 // 组合名字
26 var fullName:String = fName + " " + lName;
27
28 // 返回全名
29 return fullName;
30 }
31 }
32
33 }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: