Flex mxml和as:我在mxml中从键盘输入数text1=a、text2=b,点击button按 ...
发布网友
发布时间:2024-10-03 20:16
我来回答
共1个回答
热心网友
时间:2024-10-03 21:14
没人愿意回答这么简单的问题。
AddTest.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="vertical" minHeight="600" minWidth="955"
xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import test.Add;
]]>
</mx:Script>
<mx:FormItem label="a:">
<mx:TextInput id="aTpt" />
</mx:FormItem>
<mx:FormItem label="b:">
<mx:TextInput id="bTpt" />
</mx:FormItem>
<mx:FormItem direction="horizontal" label="结果:">
<mx:TextInput id="rTpt" />
</mx:FormItem>
<mx:ControlBar>
<mx:Button label="计算"
click="rTpt.text = Add.add(aTpt.text,bTpt.text)" />
</mx:ControlBar>
</mx:Application>
test/Add.as
package test
{
public class Add
{
public static function add( a : String, b : String ) : String
{
return ( int( a ) + int( b )).toString();
}
}
}