CR的代码文本

all for learning about the world
  订阅 订阅  :: 管理

Lingo01 - 术语

Posted on 2011-10-26 11:55  mumuliang  阅读(544)  评论(0编辑  收藏  举报

Dean's:http://www.deansdirectortutorials.com/Lingo/definitions.htm

 

参数Arguments

go [whichframe] 

set [what] to [what] 

 

命令Commands

 beep tells Director to make a beep sound. 

 

注释Comments

-- hiScore records the highest score achieved in the game
global hiScore
 

 

条件语句Conditional statements

if soundBusy(1) then go the frame 

 

常量Constant

for example:       FALSE, EMPTY 
member(1).text = "empty"        puts the word 'empty' into the text cast member.
member(1).text = EMPTY         clears everything (all text) from the cast member
 

 

事件Events 

exitFrame is when the playback head exits a frame
mouseUp is when the mouse button is released
 

 

表达式Expression

for example 1 + 1 

 

函数Function

lingo的有一些内置的表达式,譬如 go to the frame 中的the frame得到的是当前帧序号。

 the time returns the current time
 the name of member returns the cast member's name
 the key returns the key that was pressed last. 
 

函数...

 

处理程序Handlers

on eventName 

 

关键字Keywords 

...

 

列表List (线性列表Linear List和属性列表 Property List) 

lingo弱类型。列表内的元素无需考虑类型。列表可嵌套。

另,可给列表的项命名,这种叫属性列表。

e.g. ["Jack":95, "Jill":50, "Peter":65, "Sarah":75]  

普通列表就是线性列表。

e.g. ["Advanced Multimedia", "Computer-Aided Design", "Digital Design Techniques"] 

 

循环Loop

Example 1
repeat while the mouseDown
  nothing
end repeat

Example 2
repeat with x = 1 to 10
  sprite(x).visible = 1
end repeat 

You can exit a loop by using - exit repeat.
 

You can skip a particular loop and jump to next step by using - next repeat.  

repeat with x = 6 to 10
  if (x mod 2) = 1 then next repeat
  sprite(x).visible = 1
end repeat
 

 

* case 

case the rollover of 
 1: member("Message").text = "You have moved the mouse over sprite 1."
 2: member("Message").text = "You have moved the mouse over sprite 2."
 3: member("Message").text = "You have moved the mouse over sprite 3."
otherwise 
 member("Message").text = "The mouse is not over sprite 1, 2 or 3."
end case 
 

 

消息Messages 

Director用法消息的方式来通知脚本事件的发生。

 

方法Methods

它和函数的区别实际上就是,C++的成员函数和普通函数的区别。

 

操作符Operators

calculations (+, - , /, *), assignment of values (=, to, into) or comparison (<, >, =, <>) 

Logical Operator 

AND, OR, NOT. 

 

Concatenation operators, &&和&都是。用来连接字符串的

For example:
put "dean" && "utian"
-- "dean utian"
 

 

参数Parameters 

非要说和Argument的区别,可能是Param在指函数和方法定义时出现的变量;Arg是指调用时的。。

没有多大意思。

也有点意思,这样一来,me(类似this), 很显然就是param,不是arg。 

 

属性Properties

就是成员变量。 

 

符号Symbols

用户定义的常量,像c++的宏定义,又像枚举。 

以#开头,后边直接是名。

director内部应该是用整数来实现字符串的易读性。

符号中不能有标点和空格。 

For example, the statement 
userLevel = #beginner 
runs more quickly than the statement 
userLevel = "beginner"
 

字符串和符号可互转,用symbol()

 string() 。
For example
x = symbol("beginner") 
put x 
-- #novice


x = string(#beginner) 
put x 

-- "beginner"  

 

 

变量Variable

Variables exist entirely in RAM. 

Local variable, 当前handler

Global variable, 全部movie,global

Property variable, 对象上,property

3种赋值的方法,=是王道。

put value into variable -- old, dated approach
set variable to value -- verbose approach
variable = value -- best approach
 

 

数据类型DataTypes

integer, float, string, symbol, boolean, list