主题:  Lingo术语遗漏的部分!

5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#312001/12/11 15:05:44
on closeWindow

Syntax

on closeWindow
    statement(s)
end
Description

System message and event handler; contains statements that run when the user closes the window for a movie by clicking the window's close box.

The on closeWindow handler is a good place to put Lingo commands that you want executed every time the movie's window closes.

Example

This handler tells Director to forget the current window when the user closes the window that the movie is playing in:

on closeWindow
    -- perform general housekeeping here
    forget the activeWindow
end



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#322001/12/11 15:06:00
closeXlib

Syntax

closeXlib whichFile
Description

Command; closes the Xlibrary file specified by the string whichFile. If the Xlibrary file is in a folder other than that for the current movie, whichFile must specify a pathname. If no file is specified, all open Xlibraries are closed.

Xtras are stored in Xlibrary files. Xlibrary files are resource files that contain Xtras. HyperCard XCMDs and XFCNs can also be stored in Xlibrary files.

The closeXlib command doesn't work for URLs.

In Windows, using the DLL extension for Xtras is optional.

It is good practice to close any file you have opened as soon as you have finished using it.

Note: This command is not supported in Shockwave.

Example

This statement closes all open Xlibrary files:

closeXlib
Example

This statement closes the Xlibrary Video Disc Xlibrary when it is in the same folder as the movie:

closeXlib "Video Disc Xlibrary"
Example

This statement closes the Xlibrary Transporter Xtras in the folder New Xtras, which is in the same folder as the movie. The disk is identified by the variable currentDrive:

closeXlib "@:New Xtras:Transporter Xtras"
See also

interface(), openXlib, showXlib



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#332001/12/11 15:06:17
color()

Syntax

color(#rgb, redvalue, greenvalue, bluevalue)
color(#paletteIndex, paletteIndexNumber)
rgb(rgbHexString)
rgb(redvalue, greenvalue, bluevalue)
paletteIndex(paletteIndexNumber)
Description

Function and data type; determines an object's color as either RGB or 8-bit palette index values. These are the same values as those used in the color member and color sprite properties, the bgColor member and bgColor sprite properties, and the bgColor Stage property.

The color function allows for either 24-bit or 8-bit color values to be manipulated as well as applied to cast members, sprites, and the Stage.

For RGB values, each color component has a range from 0 to 255, and all other values are truncated. For paletteIndex types, an integer from 0 to 255 is used to indicate the index number in the current palette, and all other values are truncated.

Example

This statement performs a math operation:

palColorObj = paletteIndex(20)
put palColorObj
-- paletteIndex(20)
put palColorObj / 2
-- paletteIndex(10)
Example

This statement converts one color type to another type:

newColorObj = color(#rgb, 155, 0, 75)
put newColorObj
-- rgb(155, 0, 75)
newColorObj.colorType = #paletteIndex
put newColorObj
-- paletteIndex(106)
Example

This statement obtains the hexadecimal representation of a color regardless of its type:

someColorObj = color(#paletteIndex, 32)
put someColorObj.hexString()
-- "#FF0099"
Example

This statement determines individual RGB components and the paletteIndex value of a color regardless of its type:

newColorObj = color(#rgb, 155, 0, 75)
put newColorObj.green
-- 0
put newColorObj.paletteIndex
-- 106
newColorObj.green = 100
put newColorObj.paletteIndex
-- 94
put newColorObj
-- rgb(155, 100, 75)
newColorObj.paletteIndex = 45
put newColorObj
-- paletteIndex(45)
Example

This statement changes the color of the fourth through the seventh characters of text member myQuotes:

member("myQuotes").char[4..7].color = rgb(200, 150, 75)
Example

This Lingo displays the color of sprite 6 in the Message window, and then sets the color of sprite 6 to a new RGB value:

"put sprite(6).color
-- rgb( 255, 204, 102 )
sprite(6).color = rgb(122, 98, 210)"
Note: Setting the paletteIndex value of an RGB color type changes colorType to paletteIndex. Setting the RGB color type of a paletteIndex color sets its colorType value to RGB.

See also

color(), bgColor

编辑历史:[这消息被5D大叔编辑过(编辑时间2001-12-12 09:07:14)]


5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#342001/12/11 15:06:30
color (text)

Syntax

chunkExpression.color
Description

Text cast member property; indicates the color of the string chunkExpression.

This property can be tested and set.

Example

This statement sets the color of the third paragraph of the member named Short speech to red:

member("Short speech").paragraph[3].color = rgb(255, 0, 0)

编辑历史:[这消息被5D大叔编辑过(编辑时间2001-12-12 09:07:32)]


5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#352001/12/11 15:06:43
color (sprite property)

Syntax

sprite(whichSpriteNumber).color
the color of sprite whichSpriteNumber
Description

Sprite property; determines the foreground color of the sprite specified by whichSprite. Setting the foreColor sprite property is equivalent to choosing the foreground color from the Tools window when the sprite is selected on the Stage.

This property has the equivalent functionality of the foreColor sprite property, but the color value returned is a color object of whatever type has been set for that sprite.

This property can be tested and set.

See also

color(), bgColor, foreColor



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#362001/12/11 15:06:59
colorDepth

Syntax

the colorDepth
Description

System property; determines the color depth of the computer's monitor.

In Windows, using this property lets you check and set the monitor's color depth. Some video card and driver combinations may not enable you to set the colorDepth property. Always verify that the color depth has actually changed after you attempt to set it.

On the Macintosh, this property lets you check the color depth of different monitors and change it when appropriate.



Possible values are the following: 1
Black and white

2
4 colors

4
16 colors

8
256 colors

16
32,768 or 65,536 colors

32
16,777,216 colors




If you try to set a monitor's color depth to a value that monitor does not support, the monitor's color depth doesn't change.

On computers with more than one monitor, the colorDepth property refers to the monitor displaying the Stage. If the Stage spans more than one monitor, the colorDepth property indicates the greatest depth of those monitors; colorDepth tries to set all those monitors to the specified depth.

This property can be tested and set.

Example

This statement tells Director to play the segment Full color only if the monitor color depth is set to 256 colors:

if the colorDepth = 8 then play movie "Full color"
Example

The following handler tries to change the color depth, and if it can't, it displays an alert:

on TryToSetColorDepth desiredDepth
    the colorDepth = desiredDepth
    if the colorDepth = desiredDepth then
        return true
    else
        alert "Please change your system to" && desiredDepth &&"color depth and reboot."
        return false
    end if
end
When changing the user's monitor color depth settings, it is good practice to restore the original depth when the movie has finished. In Windows, the command set the colorDepth = 0 restores the user's preferred settings from the control panel.

See also

switchColorDepth



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#372001/12/11 15:07:14
commandDown

Syntax

the commandDown
Description

Function; determines whether the Control key (Windows) or the Command key (Macintosh) is being pressed (TRUE) or not (FALSE).

You can use commandDown together with the element the key to determine when the Control or Command key is pressed in combination with another key. This lets you create handlers that are executed when the user presses specified Control or Command key combinations.

Control or Command key equivalents for Director's authoring menus take precedence while the movie is playing, unless you have installed custom Lingo menus or are playing a projector version of the movie.

For a movie playing back with the Director player for Java, this function returns TRUE only if a second key is pressed simultaneously with the Control or Command key. If the Control or Command key is pressed by itself, commandDown returns FALSE. This is because the browser receives the keys before the movie and thus responds to and intercepts any key combinations that are also browser keyboard shortcuts. For example, if the user presses Control+R or Command+R, the browser reloads the current page; the movie never receives the key combination.

For a demonstration of modifier keys in Lingo, see the sample movie "Keyboard Lingo" in Director Help.

Example

These statements pause a projector whenever the user presses Control+ or Command+A. By setting the keyDownScript property to doCommandKey, the on prepareMovie handler makes the doCommandKey handler the first event handler executed when a key is pressed. The doCommandKey handler checks whether the Control+A or Command+A keys are pressed at the same time and pauses the movie if they are.

on prepareMovie
    the keyDownScript = "doCommandKey"
end
on doCommandKey
    if (the commandDown) and (the key = "a") then go to the frame
end
See also

controlDown, key(), keyCode(), optionDown, shiftDown



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#382001/12/11 15:07:27
comments

Syntax

member.comments
the comments of member
Description

This cast member property provides a place to store any comments you want to maintain about the given cast member, or any other strings you want to associate with the member. This property can be tested and set. It can also be set in the Property Inspector's Member tab.

Example

This statement sets the comments of the member Backdrop to the string "Still need to license this artwork":

member("Backdrop").comments = "Still need to license this artwork"
See also

creationDate, modifiedBy, modifiedDate

编辑历史:[这消息被5D大叔编辑过(编辑时间2001-12-12 09:07:50)]


5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#392001/12/11 15:07:41
constrainH()

Syntax

constrainH (whichSprite, integerExpression)
Description

Function; evaluates integerExpression and then returns a value that depends on the horizontal coordinates of the left and right edges of whichSprite, as follows:

When the value is between the left and right coordinates, the value doesn't change.

When the value is less than the left horizontal coordinate, the value changes to the value of the left coordinate.

When the value is greater than the right horizontal coordinate, the value changes to the value of the right coordinate.



The constrainH and constrainV functions constrain only one axis each; the constraint sprite property limits both. Note that this function does not change the sprite's properties.

Example

These statements check the constrainH function for sprite 1 when it has left and right coordinates of 40 and 60:

put constrainH(1, 20)
-- 40
put constrainH(1, 55)
-- 55
put constrainH(1, 100)
-- 60
Example

This statement constrains a moveable slider (sprite 1) to the edges of a gauge (sprite 2) when the mouse pointer goes past the edge of the gauge:

set the locH of sprite 1 to constrainH(2, the mouseH)
See also

constrainV(), constraint, left, right



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#402001/12/11 15:07:55
constraint

Syntax

sprite(whichSprite).constraint
the constraint of sprite whichSprite
Description

Sprite property; determines whether the registration point of the sprite specified by whichSprite is constrained to the bounding rectangle of another sprite (1 or TRUE) or not (0 or FALSE, default).

The constraint sprite property is useful for constraining a moveable sprite to the bounding rectangle of another sprite to simulate a track for a slider control or to restrict where on the screen a user can drag an object in a game.

The constraint sprite property affects moveable sprites and the locH and locV sprite properties. The constraint point of a moveable sprite cannot be moved outside the bounding rectangle of the constraining sprite. (The constraint point for a bitmap sprite is the registration point. The constraint point for a shape sprite is its top left corner.) When a sprite has a constraint set, the constraint limits override any locH and locV sprite property settings.

This property can be tested and set.

Example

This statement removes a constraint sprite property:

Dot syntax:

sprite(whichSprite).constraint = 0
Verbose syntax:

set the constraint of sprite whichSprite to 0
Example

This statement constrains sprite (i + 1) to the boundary of sprite 14:

sprite(i + 1).constraint = 14
Example

This statement checks whether sprite 3 is constrained and activates the handler showConstraint if it is: (The operator <> performs a not-equal-to operation.)

if sprite(3).constraint <> 0 then showConstraint
See also

constrainH(), constrainV(), locH, locV



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#412001/12/11 15:08:15
constrainV()

Syntax

constrainV (whichSprite, integerExpression)
Description

Function; evaluates integerExpression and then returns a value that depends on the vertical coordinates of the top and bottom edges of the sprite specified by whichSprite, as follows:

When the value is between the top and bottom coordinates, the value doesn't change.

When the value is less than the top coordinate, the value changes to the value of the top coordinate.

When the value is greater than the bottom coordinate, the value changes to the value of the bottom coordinate.



This function does not change the sprite properties.

Example

These statements check the constrainV function for sprite 1 when it has top and bottom coordinates of 40 and 60:

put constrainV(1, 20)
-- 40
put constrainV(1, 55)
-- 55
put constrainV(1, 100)
-- 60
Example

This statement constrains a moveable slider (sprite 1) to the edges of a gauge (sprite 2) when the mouse pointer moves past the edge of the gauge:

set the locV of sprite 1 to constrainV(2, the mouseV)
See also

bottom, constraint, top, constrainH()



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#422001/12/11 15:08:38
cpuHogTicks

Syntax

the cpuHogTicks
Description

System property; determines how often Director releases control of the CPU to let the computer process background events, such as events in other applications, network events, clock updates, and other keyboard events.

The default value is 20 ticks. To give more time to Director before releasing the CPU to background events or to control how the computer responds to network operations, set cpuHogTicks to a higher value.

To create faster auto-repeating key performance but slower animation, set cpuHogTicks to a lower value. In a movie, when a user holds down a key to generate a rapid sequence of auto-repeating key presses, Director typically checks for auto-repeating key presses less frequently than the rate set in the computer's control panel.

The cpuHogTicks property works only on the Macintosh.

Example

This statement tells Director to release control of the CPU every 6 ticks, or every 0.10 of a second:

the cpuHogTicks = 6
See also

ticks



5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#432001/12/11 15:09:08
curve

Syntax

member.curve[curveListIndex]
Description

This property contains the vertexList of an individual curve (shape) from a vector shape cast member. You can use the curve property along with the vertex property to get individual vertices of a specific curve in a vector shape.

A vertexList is a list of vertices, and each vertex is a property list containing up to three properties: a #vertex property with the location of the vertex, a #handle1 property with the location of the first control point for that vertex, and a #handle2 property with the location of the second control point for that vertex. See vertexList.

Example

This statement displays the list of vertices of the third curve of vector shape member SimpleCurves:

put member("SimpleCurves").curve[3]
-- [[#vertex: point(113.0000, 40.0000), #handle1: point(32.0000, 10.0000), #handle2: point(-32.0000, -10.0000)], [#vertex: point(164.0000, 56.0000)]]
Example

This statement moves the first vertex of the first curve in a vector shape down and to the right by 10 pixels:

member(1).curve[1].vertex[1] = member(1).curve[1].vertex[1] + point(10, 10)
Example

The code below moves a sprite to the location of the first vertex of the first curve in a vector shape. The vector shape's originMode must be set to #topLeft for this to work.

vertexLoc = member(1).curve[1].vertex[1]
spriteLoc = mapMemberToStage(sprite(3), vertexLoc)
sprite(7).loc = spriteLoc
vertex, vertexList

编辑历史:[这消息被5D大叔编辑过(编辑时间2001-12-12 09:08:17)]


5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#442001/12/11 15:09:29
curve

Syntax

member.curve[curveListIndex]
Description

This property contains the vertexList of an individual curve (shape) from a vector shape cast member. You can use the curve property along with the vertex property to get individual vertices of a specific curve in a vector shape.

A vertexList is a list of vertices, and each vertex is a property list containing up to three properties: a #vertex property with the location of the vertex, a #handle1 property with the location of the first control point for that vertex, and a #handle2 property with the location of the second control point for that vertex. See vertexList.

Example

This statement displays the list of vertices of the third curve of vector shape member SimpleCurves:

put member("SimpleCurves").curve[3]
-- [[#vertex: point(113.0000, 40.0000), #handle1: point(32.0000, 10.0000), #handle2: point(-32.0000, -10.0000)], [#vertex: point(164.0000, 56.0000)]]
Example

This statement moves the first vertex of the first curve in a vector shape down and to the right by 10 pixels:

member(1).curve[1].vertex[1] = member(1).curve[1].vertex[1] + point(10, 10)
Example

The code below moves a sprite to the location of the first vertex of the first curve in a vector shape. The vector shape's originMode must be set to #topLeft for this to work.

vertexLoc = member(1).curve[1].vertex[1]
spriteLoc = mapMemberToStage(sprite(3), vertexLoc)
sprite(7).loc = spriteLoc
vertex, vertexList

编辑历史:[这消息被5D大叔编辑过(编辑时间2001-12-12 09:08:36)]


5D荣誉斑竹

职务:普通成员
等级:2
金币:10.0
发贴:454
注册:2001/9/6 10:45:11
#452001/12/11 15:10:36
debugPlaybackEnabled

Syntax

debugPlaybackEnabled
Description

Property; opens a Message window for debugging purposes in Shockwave and projectors. It does not have any effect when used in the Director application. Once the Message window is closed, it cannot be re-opened for a particular Shockwave or projector session. If more than one shockwave movie uses this Lingo in a single browser, only the first will open a Message window, and the Message window will be tied to the first movie alone.

To open this Message window, set the debugPlaybackEnabled property to TRUE. To close the window, set the debugPlaybackEnabled property to FALSE.

Note: In Shockwave on the Macintosh, rather than a Message window being opened, a log file is generated to allow "put" statements to output data for debugging purposes. This file is located in the Shockwave 8 folder at HardDrive:System Folder:Extensions:Macromedia:Shockwave 8.