This demo mainly explains the data type of AS3, first look at the running effect of the demo page, very simple:
The main code is as follows:
<mx:Script>
<![CDATA [
public function parseInteger(str:String):int {
var num:Number = parseInt(str);
if (!isNaN(num) && num <= int.MAX_VALUE && num >= int.MIN_VALUE) {
return int(num);
}
return 0;
}
internal function AbAdd():void {
var iAnum:int = parseInteger(ATxt.text);
var iBnum:int = parseInteger(BTxt.text);
AddTxt.text = String(iAnum + iBnum);
}
internal function UnStr():void {
ShowTxt.text = undefined;
}
internal function StrUndef():void {
ShowTxt.text = String(undefined);
}
]]>
</mx:Script>
The emphasis is on the type of int and string for the data type.
for int, the reader must note that int is an object, that is, int is a class that represents a 32-bit signed integer data type, and others see demo examples.
For String,demo, the undefined is null in AS3, not undefined, and if you want to display undefined, you need to use the string () function.
For other data types, the authors recommend a Web site that not only learns about other types of data, but also has basic syntax, which is very good:
ActionScript3.0 Language and component references (oh in Chinese)
http://help.adobe.com/zh_CN/AS3LCR/Flash_10.0/
Oh, demo simple, so everyone is easy to understand:
This stage of the demo is mainly to explain AS3 's grammar and its own characteristics. After the basics of this phase, access to the database, Java Communications, Web development based on flex and so on will be slowly spread out.
Article Source: http://wangyisong.javaeye.com/blog/372543