actionscript
程序员文章站
2022-03-15 20:17:50
...
var a:int = 5; var b:uint = 5; trace(a==b); trace(a===b); b = 3; trace(a<b); trace(a>=0&&a<=10); trace(typeof 10); trace(typeof true); trace(typeof Object); trace(typeof [1,2,3]); trace(9 is Number); trace([1,2] is Number); trace([1,2] is Array); trace(9 as Number); trace(9 as Array); var arrs:Array = ["a","b","c"]; trace(2 in arrs); trace(3 in arrs); var aObject:Object = {age:10}; trace("age" in aObject); var bObject:Object = {"status":"ok"}; delete bObject.status; trace(bObject.status);
结果
true true false true number boolean object object true false true 9 null true false true undefined
var a:Object={"name":"sanco","age":25,"weight":50}; for(var k in a){ trace("Key:\t"+k+"\tValue:\t"+a[k]); } for each(var j in a){ trace("Key:\t"+j+"\tValue:\t"+a[j]); }
结果
Key: weight Value: 50
Key: name Value: sanco
Key: age Value: 25
Key: 50 Value: undefined
Key: sanco Value: undefined
Key: 25 Value: undefined
Key: name Value: sanco
Key: age Value: 25
Key: 50 Value: undefined
Key: sanco Value: undefined
Key: 25 Value: undefined
推荐阅读
-
用仿ActionScript的语法来编写html5——终篇
-
用仿ActionScript的语法来编写html5——第六篇,TextField与输入框
-
Flash中的ActionScript3.0脚本语言制作小游戏
-
ActionScript的API文档生成工具ASDoc
-
Flash Actionscript常用的几段代码
-
优化Flash Actionscript代码的三种方法
-
用仿ActionScript的语法来编写html5——终篇,LegendForHtml5Programming1.0开源库件
-
ActionScript3教程:语句实例
-
ActionScript使用正则表达式示例
-
Flash教程 认识Flash ActionScript的环境