425
The first statement in the following example creates a child object from the above script in the
preceding example, and places it in a variable named
myBird
. The second statement makes the
bird fly by calling the fly handler in the Bird parent script:
myBird = script("Bird").new()
myBird.fly()
This statement uses a new Bird parent script, which contains the property variable
speed
:
property speed
on new me, initSpeed
speed = initSpeed
return me
end
on fly me
put "I am flying at " & speed & "mph"
end
The following statements create two child objects called myBird1 and myBird2. They are given
different starting speeds: 15 and 25, respectively. When the fly handler is called for each child
object, the speed of the object is displayed in the Message window.
myBird1 = script("Bird").new(15)
myBird2 = script("Bird").new(25)
myBird1.fly()
myBird2.fly()
This message appears in the Message window:
-- "I am flying at 15 mph"
-- "I am flying at 25 mph"
This statement creates a new timeout object called intervalTimer that will send a timeout event to
the
on minuteBeep
handler in the child object playerOne every 60 seconds:
timeout("intervalTimer").new(60000, #minuteBeep, playerOne)
See also
on stepFrame
,
actorList
,
ancestor
,
me
,
type (cast member property)
,
timeout()
newCamera
Syntax
member(
whichCastmember
).newCamera(
newCameraName
)
Description
3D command; creates a new camera,
newCameraName
, within the cast member. The name
specified for
newCameraName
must be unique within the cast member.
Example
This statement creates a new camera called in-car camera:
member("3D World").newCamera("in-car camera")
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...