Articles Archive
Director Forums
Director Wiki
Job Board
Search
 
 Director Online WikiMain Page | About | Help | FAQ | Special pages | Log in | Printable version | Disclaimers

New

From Director Online Wiki

Keyword in both Lingo and JavaScript that is used to create an instance of an object from a script or Xtra or new members.

Syntax:

Creating a member (type is a symbol or string for the member type):

new(type)
new(type, castLib whichCast)
new(type, member whichCastMember of castLib whichCast)
Table of contents

1 Bugs/Quirks/Problems
2 See also

script instances

vInstance = new(parentScript, arg1, arg2, ...)
vInstance = script("Parent Script Name").new(arg1, arg2, ...)
new(script Parent Script Name", value1, value2, ...)

timeout objects

Director 8.0 to MX

timeout("name").new(timeoutPeriod, #timeoutHandler {, targetObject})

Director 10

timeOut().new("name", timeOutPeriod, #timeOutHandler {, targetObject})

If you open an older (prior to MX 2004) Director movie into MX 2004, then the scriptExecutionStyle is set to 9, and you'll have to use the older timeout syntax. You can always set the scriptExecutionStyle to 10, and use the new syntax, but then, if you're already dealing with MIAWs or timeout objects, you will have to change the relevant code lines to conform with the MX 2004 style.

See: Syntax changes in Director MX 2004

xtra instances

new(xtra "xtraName")
vInstance = xtra("xtraName").new()

member

vMember = new(#field)
vMember = new("field")
vMember = new(#field, member(3,1) )  --  overwrites existing member if necessary.

Bugs/Quirks/Problems

If you call for instance...

new(#bitmap)

... and have a Movie Script with a new() handler, then the handler of the script will be called. In this case you will not get a member (probably the return value will be #bitmap). So if you get this error - keep a look out if you mistakenly set a Parent Script or behavior to Movie Script in the properties dialog.

See also

newMember

Retrieved from "http://www.director-online.com/dougwiki/index.php/New"

This page has been accessed 2320 times. This page was last modified 19:56, 6 Jun 2005.