Detailed instructions for use are in the User's Guide.
[. . . ] DIRECTOR MX
2004
Director Scripting Reference
Trademarks ActiveEdit, ActiveTest, Add Life to the Web, Afterburner, Aftershock, Andromedia, Allaire, Animation PowerPack, Aria, Attain, Authorware, Authorware Star, Backstage, Blue Sky Software, Blue Sky, Breeze, Bright Tiger, Clustercats, ColdFusion, Contents Tab Composer, Contribute, Design In Motion, Director, Dream Templates, Dreamweaver, Drumbeat 2000, EDJE, EJIPT, Extreme 3D, Fireworks, Flash, FlashHelp, Flash Lite, FlashPaper, Flex, Flex Builder, Fontographer, FreeHand, Generator, Help To Source, HomeSite, Hotspot Studio, HTML Help Studio, JFusion, JRun, Kawa, Know Your Site, Knowledge Objects, Knowledge Stream, Knowledge Track, LikeMinds, Lingo, Live Effects, MacRecorder Logo and Design, Macromedia, Macromedia Action!, Macromedia Central, Macromedia Flash, Macromedia M Logo and Design, Macromedia Spectra, Macromedia xRes Logo and Design, MacroModel, Made with Macromedia, Made with Macromedia Logo and Design, MAGIC Logo and Design, Mediamaker, Movie Critic, Open Sesame!, RoboDemo, RoboEngine JFusion, RoboHelp, RoboHelp Office, RoboInfo, RoboInsight, RoboPDF, 1-Step RoboPDF, RoboFlash, RoboLinker, RoboScreenCapture, ReSize, Roundtrip, Roundtrip HTML, Shockwave, Sitespring, Smart Publishing Wizard, Software Video Camera, SoundEdit, Titlemaker, UltraDev, Web Design 101, what the web can be, WinHelp, WinHelp 2000, WinHelp BugHunter, WinHelp Find+, WinHelp Graphics Locator, WinHelp Hyperviewer, WinHelp Inspector, and Xtra are either registered trademarks or trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally. [. . . ] When looped is TRUE, the first iteration of the loop begins at offset and ends at endTime. All subsequent repetitions begin at cropStart and end at endTime. Set endTime to -1 if you want the motion to play to the end. Specifies the actual speed of the motion's playback. scale is multiplied by the playRate property of the model's #keyframePlayer modifier or #bonesPlayer modifier to
determine the actual speed of the motion's playback.
offset Optional. Measured in milliseconds from the beginning of the motion. When looped is FALSE, the motion begins at offset and ends at endTime. When looped is TRUE, the first iteration of the loop begins at offset and ends at endTime. All subsequent repetitions begin at startTime and end at endTime. Example
The following Lingo adds the motion named Fall to the end of the bonesPlayer playlist of the model named Walker. When all motions before Fall in the playlist have been executed, Fall will play one time from beginning to end.
sprite(1). member. model("Walker"). bonesPlayer. queue\ ("Fall", 0, 0, -1, 1, 0)
486
Chapter 12: Methods
The following Lingo adds the motion named Kick to the end of the bonesPlayer playlist of the model named Walker. When all motions before Kick in the playlist have been executed, a section of Kick will play in a continuous loop. The first iteration of the loop will begin 2000 milliseconds from the motion's beginning. All subsequent iterations of the loop will begin 1000 milliseconds from Kick's beginning and will end 5000 milliseconds from Kick's beginning. The rate of playback will be three times the playRate property of the model's bonesPlayer modifier.
sprite(1). member. model("Walker"). bonesPlayer. queue("Kick", 1, \ 1000, 5000, 3, 2000) See also play() (3D), playNext() (3D), playRate (3D)
QuickTimeVersion()
Usage -- Lingo syntax QuickTimeVersion() // JavaScript syntax QuickTimeVersion(); Description
Function; returns a floating-point value that identifies the current installed version of QuickTime and replaces the current QuickTimePresent function. In Windows, if multiple versions of QuickTime 3. 0 or later are installed, QuickTimeVersion() returns the latest version number. If a version before QuickTime 3. 0 is installed, QuickTimeVersion() returns version number 2. 1. 2 regardless of the version installed.
Parameters
None.
Example
This statement uses QuickTimeVersion() to display in the Message window the version of QuickTime that is currently installed:
-- Lingo syntax put(QuickTimeVersion()) // JavaScript syntax put(QuickTimeVersion());
quit()
Usage -- Lingo syntax _player. quit() // JavaScript syntax _player. quit(); Description
Player method; exits from Director or a projector to the Windows desktop or Macintosh Finder.
quit()
487
Parameters
None.
Example
This statement tells the computer to exit to the Windows desktop or Macintosh Finder when the user presses Control+Q in Windows or Command+Q on the Macintosh:
-- Lingo syntax if (_key. key = "q" and _key. commandDown) then _player. quit() end if // JavaScript syntax if (_key. key == "q" && _key. commandDown) { _player. quit(); } See also Player
ramNeeded()
Usage -- Lingo syntax _movie. ramNeeded(intFromFrame, intToFrame) // JavaScript syntax _movie. ramNeeded(intFromFrame, intToFrame); Description
Movie method; determines the memory needed, in bytes, to display a range of frames. For example, you can test the size of frames containing 32-bit artwork: if ramNeeded() is larger than freeBytes(), then go to frames containing 8-bit artwork and divide by 1024 to convert bytes to kilobytes (K).
Parameters intFromFrame intToFrame Example
Required. An integer that specifies the number of the first frame in the range.
Required. An integer that specifies the number of the last frame in the range.
This statement sets the variable frameSize to the number of bytes needed to display frames 100 to 125 of the movie:
-- Lingo syntax frameSize = _movie. ramNeeded(100, 125) // JavaScript syntax var frameSize = _movie. ramNeeded(100, 125);
488
Chapter 12: Methods
This statement determines whether the memory needed to display frames 100 to 125 is more than the available memory, and, if it is, branches to the section using cast members that have lower color depth:
-- Lingo syntax if (_movie. ramNeeded(100, 125) > _system. freeBytes) then _movie. go("8-bit") end if // JavaScript syntax if (_movie. ramNeeded(100, 125) > _system. freeBytes) { _movie. go("8-bit"); } See also freeBytes(), Movie
random()
Usage -- Lingo syntax random(integerExpression) // JavaScript syntax random(integerExpression); Description
Top level function; returns a random integer in the range 1 to a specified value. This function can be used to vary values in a movie, such as to vary the path through a game, assign random numbers, or change the color or position of sprites. To start a set of possible random numbers with a number other than 1, subtract the appropriate amount from the random() function. [. . . ] This means that the y-axis of ModCylinder is aligned with the y-axis of the world. The next line rotates ModCylinder 90 around its x-axis. This rotates the axes of ModCylinder as well. The last two lines show that the y-axis of ModCylinder is now the vector (0. 0000, 0. 0000, 1. 0000). [. . . ]