Localtoglobal (Movieclip.localtoglobal Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

The params.txt file includes the following text:
var1="hello"&var2="goodbye"&done="done"
The
method used in this example requires Flash Player
MovieClip.getNextHighestDepth()
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
method.
MovieClip.getNextHighestDepth()
See also
,
,
loadMovie (MovieClip.loadMovie method)
loadVariablesNum function
unloadMovie (MovieClip.unloadMovie method)

localToGlobal (MovieClip.localToGlobal method)

public localToGlobal(pt:Object) : Void
Converts the
object from the movie clip's (local) coordinates to the Stage (global)
pt
coordinates.
The
method allows you to convert any given x and y
MovieClip.localToGlobal()
coordinates from values that are relative to the top-left corner of a specific movie clip to values
that are relative to the top-left corner of the Stage.
You must first create a generic object that has two properties,
and
. These
and
values
x
y
x
y
(and they must be called
and
) are called the local coordinates because they relate to the
x
y
top-left corner of the movie clip. The x property represents the horizontal offset from the top-
left corner of the movie clip. In other words, it represents how far to the right the point lies.
For example, if x = 50, the point lies 50 pixels to the right of the top-left corner. The y
property represents the vertical offset from the top-left corner of the movie clip. In other
words, it represents how far down the point lies. For example, if y = 20, the point lies 20 pixels
below the top-left corner. The following code creates a generic object with these coordinates.
var myPoint:Object = new Object();
myPoint.x = 50;
myPoint.y = 20;
Alternatively, you can create the object and assign the values at the same time with a literal
Object value.
var myPoint:Object = {x:50, y:20};
After you create a point object with local coordinates, you can convert the coordinates to
global coordinates. The
method doesn't return a value because it changes
localToGlobal()
the values of
and
in the generic object that you send as the parameter. It changes them
x
y
from values relative to a specific movie clip (local coordinates) to values relative to the Stage
(global coordinates).
MovieClip
893

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF