MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 748

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

Avoiding absolute targets (_root)
You can use several methods to target instances that let you avoid using
are discussed later in this section. Avoid using
that load into other SWF files might not work correctly. The
SWF file that is loading, not the SWF file using relative addressing instead of
issue limits code portability in SWF files that are loaded into another file, and, particularly, in
components and movie clips. You can help resolve problems by using
use
when necessary (such as when you are loading a SWF file but do not have
_lockroot
access to the FLA file). For more information on using
on page
748.
Use
,
this
this._parent
ActionScript 2.0 code is located. The following example shows relative addressing:
myClip.onRelease = function() {
trace(this._parent.myButton._x);
};
All variables must be scoped, except for variables that are function parameters, and local
variables. Scope variables relative to their current path whenever possible, using relative
addressing, such as the
this property in the ActionScript 2.0 Language Reference.
Using _lockroot
You can use
_lockroot
associated with the inappropriate use of
applications, consider
you experience problems loading content into a SWF file or a component instance, try
applying
_lockroot
clip called
loading content, and it stops working after it is loaded, try using the
myClip
following code, which is placed on a timeline:
this._lockroot = true;
748
Best Practices and Coding Conventions for ActionScript 2.0
, or
keywords rather than
_parent
property. For more information on using the
this
to target content as a way to solve the scoping issues sometimes
_root
as a work-around for problems caused by using
_lockroot
to a movie clip that loads the content. For example, if you have a movie
in ActionScript 2.0 because SWF files
_root
_root
, see
_lockroot
, depending on where your
_root
. Although this solves many problems with
; these methods
_root
identifier targets the base
. This
_root
, but only
_lockroot
"Using _lockroot"
property, see
this
. If
_root

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents