Flash Lite 1.x ActionScript 语言参考 |
|
|
|
| Flash Lite 语句 > if | |||
Flash Lite 1.0。
if (condition) {statement(s); }
condition 计算结果为 true 或 false 的表达式。
statement 当条件的计算结果为 true 时要执行的指令。
语句;对条件进行计算以确定 SWF 文件中的下一步动作。如果条件为 true,则 Flash Lite 将运行条件后面大括号 ({}) 内的语句。如果条件为 false,则 Flash Lite 将跳过大括号内的语句,而运行大括号后面的语句。使用 if 语句可在脚本中创建分支逻辑。
在以下示例中,括号内的条件对变量 name 进行计算,以查看其是否具有文本值 "Erica"。如果有,则运行 play() 函数。
if(name eq "Erica"){
play();
}
|
|
|
|