1 // in getName.as
2 package com.adobe.syUtils
3 {
4 public function getName():String
5 {
6 return "my name is bona shen";
7 }
8 }
不过一个文件中只能定义一个public属性的公用函数。2 package com.adobe.syUtils
3 {
4 public function getName():String
5 {
6 return "my name is bona shen";
7 }
8 }
1 //in other use.as
2 import com.adobe.syUtils.getName;
3 import mx.controls.Alert;
4 public class Test
5 {
6 public function Test()
7 {
8 Alert.show(getName());
9 }
10 }
11
2 import com.adobe.syUtils.getName;
3 import mx.controls.Alert;
4 public class Test
5 {
6 public function Test()
7 {
8 Alert.show(getName());
9 }
10 }
11