new Object( ); // Object dies immediately after it's created,
// and we can't refer to it
var thing = new Object( ); // Object reference is stored in thing,
// and can later be referred to as thing
Movie clip instances need not be stored in variables in order for us
to refer to them. Unlike normal data objects, clip instances are
accessible in ActionScript via their instance names as soon as they
are created. For example:
ball._ y = 200;
Each clip's instance name is stored in its built-in property,
_name, which can be both retrieved and set:
ball._name = "circle"; // Change ball's name to circle
When we change an instance's _name property,
all future references to the instance must use the new name. For
example, after the previous code executes, the
ball reference ceases to exist, and we'd
subsequently use circle to refer to the instance.
The manner in which an instance initially gets its instance name
depends on how it was created. Programmatically generated instances
are named by the function that creates them. Manually created
instances are normally assigned explicit instance names in the
authoring tool through the Instance panel, as follows:
Select the instance on stage.
Select Modify
Instance.
Enter the instance name into the Name field.
If a manually created clip is not given an instance name, it is
assigned one automatically by the Flash Player at runtime. Automatic
instance names fall in the sequence instance1,
instance2,
instance3...instancen,
but these names don't meaningfully describe our clip's
content (and we must guess at the automatic name that was generated).