1

    <!--调用外部as文件-->

    <fx:Script>
<![CDATA[
import mx.controls.Alert;
import a.Test3;
]]>
</fx:Script>
<s:Group>
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:TextInput id="value3"/>
<mx:Label text="and"/>
<s:TextInput id = "value4"> </s:TextInput>
<s:Button label="连接字符串" click="Alert.show(textMerge(value3.text,value4.text))"/>
</s:Group>

a.Test3.as

package a
{
import flash.sampler.Sample; public class Test3
{
public function textMerge(input1:String,input2:String):String
{ var x:String = input1 +input2;
return x; }
}
}

2Flex4学习笔记2--代码保存在单独的文件中-LMLPHP

3

05-11 10:54