User Guide
Cast member methods 345
Cast member methods
If the models and model resources you need aren’t contained in a particular cast member, the
following methods let you create models and model resources using other 3D cast members
at runtime.
Method Description Returns
loadFile
(fileName,
Overwrite,
GenerateUnique
Names)
This method loads a W3D format file from
fileName, adds all models as children of the world,
and updates all palettes.
You can call this method only if the cast member’s
state property is either -1, meaning that an error
occurred during a previous attempt to load the file,
or
4, meaning that media loading is complete. If an
attempt is made to call
loadFile while the cast
member is streaming media in, a script error is
generated.
Overwrite is an optional variable that can be TRUE
(1)
or FALSE (0):
TRUE (1) means the old world is replaced by the
contents of the file.
FALSE (0) means the new file is merged into the
existing world.
GenerateUniqueNames is a variable that has no
meaning unless
Overwrite is FALSE (0).
If
Overwrite is FALSE (0), then if
GenerateUniqueNames is TRUE (1), all new elements
sharing the same name as existing elements are
assigned a new, algorithmically determined unique
name.
If
GenerateUniqueNames is FALSE (0), all existing
elements sharing the same name as new elements
being read into the file are replaced by the new
elements.
Nothing if the
operation is
successful, or a script
error if the operation
fails
cloneModelFrom
Castmember
(name, model,
castmember)
Performs a deep clone of a model from one cast
member and puts it into another cast member.
The model, its resources, its children, and its
children’s resources all are put into the new
cast member.
A model object
cloneMotion
FromCastMember
(name, motion,
castmember)
Performs a deep clone of a motion from one cast
member and puts it into another cast member.
A motion object