Syntax changes in Director MX 2004

From Director Online Wiki
Jump to: navigation, search

In Director 10 (Director MX 2004), the syntax used for creating new objects was standardized. A new movie property? the scriptExecutionStyle? was introduced so that movies created in version 9 (MX) and earlier will still function correctly. By default, any movie last saved in a version of Director prior to MX 2004 will be set to use...

the scriptExecutionStyle = 9

Movies saved in Director MX 2004 or later are set by default to use...

the scriptExecutionStyle = 10

In Director MX 2004, you can explicitly set the value of the scriptExecutionStyle? so that you can continue to use scripts written for earlier versions.

Member

9

vMember = member("Non Existant")
put vMember
-- (member -1 of castLib 1)

10

 vMember = member("Non Existant")
put vMember
-- <Void>

Script

9

vScript = script("Non Existant")
*** Script error: Script cast member not found ***

10

vScript = script("Non Existant")
put vScript
-- <Void>

TimeOut Object

9

vTimeOut = timeOut("TimeOut Name").new(timeOutPeriod, #timeOutHandler {, targetObject})

10

vTimeOut = timeOut().new("TimeOut Name", timeOutPeriod, #timeOutHandler {, targetObject})

Window

9

put window("Non Existant") -- window() creates a new window
-- (window "Non Existant")
open window("Window Name")

10

put window("Non Existant") -- no such window exists, and none is created
-- <Void>
vWindow = window().new("Window Name")
open vWindow

Xtra

9

vXtra = xtra("Non Existant")
*** Script error: xtra not found ***

10

vXtra = xtra("Non Existant")
put vXtra
-- <Void>

Note: The Director 10 syntax for creating an instance of an xtra does not follow that for windows:

put xtra("FileIO").new()
-- <Xtra child "fileio" 1 730d140>
put xtra().new("FileIO")
*** Script error: one parameter expected ***