Code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundGradientColors="[0xFFFFFF, 0xAAAAAA]"
horizontalAlign="left"
verticalGap="15"
horizontalGap="15">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function MultiplicationTable()
{
var s:String="九九乘法表\n";
for(var i:Number=1;i<=9;i++)
{
for(var j:Number=1;j<=i;j++)
{
s+=i +"*"+ j +"=" + (i*j)+ " ";
}
s+="\n";
}
lblTitle.text=s;
//弹出显示结果
Alert.show(s);
}
]]>
</mx:Script>
<mx:Button label="九九乘法表" click="MultiplicationTable()">
</mx:Button>
<mx:Label id="lblTitle" text="" width="608" height="314" fontSize:"20px">
</mx:Label>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundGradientColors="[0xFFFFFF, 0xAAAAAA]"
horizontalAlign="left"
verticalGap="15"
horizontalGap="15">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function MultiplicationTable()
{
var s:String="九九乘法表\n";
for(var i:Number=1;i<=9;i++)
{
for(var j:Number=1;j<=i;j++)
{
s+=i +"*"+ j +"=" + (i*j)+ " ";
}
s+="\n";
}
lblTitle.text=s;
//弹出显示结果
Alert.show(s);
}
]]>
</mx:Script>
<mx:Button label="九九乘法表" click="MultiplicationTable()">
</mx:Button>
<mx:Label id="lblTitle" text="" width="608" height="314" fontSize:"20px">
</mx:Label>
</mx:Application>
截图:
来源:https://www.cnblogs.com/wenjl520/archive/2008/10/23/1318257.html
标签