interactive scripting - CGR C/092 - fall 2004
Philip van Allen - v a n a l l e n @ a r t c e n t e r . e d u

room 142, Monday 4:00pm-7:00pm
all materials on this web site © copyright 2004, Philip van Allen
 
week 04b - variables & variable scope, properties, Math.random()


properties : 


  
manipulating movieClips

introduction : 

Each instance of a movieclip on the stage has its own features such as scale, location on the stage, and transparency. These features can be read and in most cases changed in ActionScript by addressing the properties of a movieClip instance. These properties are addressed using the dot syntax format of movieClip._property. For example, to change the transparency of a movieclip, the following code would set the current movieClip to be 50% transparent:

on (release) {
    this._alpha = 50; // _alpha has values of 0            to 100
} 

Most of the properties in Flash apply to the main timeline as well as movieClip instances. For example, to make a movieClip track the current cursor position so it behaves as a custom cursor, the following code could be put in the movieClip:

onClipEvent (enterFrame) {
    Mouse.hide(); // hides the normal cursor
    this._x = _root._xmouse; // sets the movie clip            to the x mouse position
    this._y = _root._ymouse; // sets the movie clip            to the y mouse position
} 

Note that if a property is changed using ActionScript, any timeline tweening of the movieClip will cease to operate. In other words, at the time a movieClip property is changed, the link between a timeline and the movieClip is broken.

 

 
the properties : 

A list of Flash MX properties is on page 624 of the ActionScript textbook. A complete list of Flash MX properties, with links to explanations of each property is listed in the Flash help system under:

HELP>ACTIONSCRIPT DICTIONARY>ACTIONSCRIPT LANGUAGE REFERENCE>M>MOVIECLIP CLASS

This list of Flash MX properties is reproduced here with the addition of a column for value ranges. Some of the visual properties are highlighted in blue:

Property

Description

Range

MovieClip._alpha

The transparency value of a movie clip instance.

0 to 100
MovieClip._currentframe

The frame number in which the playhead is currently located.

1 to _totalFrames
MovieClip._droptarget

The absolute path in slash syntax notation of the movie clip instance on which a draggable movie clip was dropped.

object path
MovieClip.enabled

Indicates whether a button movie clip is enabled.

true/false

MovieClip.focusEnabled

Enables a movie clip to receive focus.

true/false

MovieClip._focusrect

Indicates whether a focused movie clip has a yellow rectangle around it.

true/false

MovieClip._framesloaded

The number of frames that have been loaded from a streaming movie.

0 to _totalFrames

MovieClip._height

The height of a movie clip instance, in pixels.

integer

MovieClip.hitArea

Designates another movie clip to serve as the hit area for a button movie clip.

object path

MovieClip._highquality

Sets the rendering quality of a movie.

0 to 2

MovieClip._name

The instance name of a movie clip instance.

text

MovieClip._parent

A reference to the movie clip that encloses the movie clip.

object path

MovieClip._rotation

The degree of rotation of a movie clip instance.

multiple of 0 to 360

MovieClip._soundbuftime

The number of seconds before a sound starts to stream.

seconds

MovieClip.tabChildren

Indicates whether the children of a movie clip are included in automatic tab ordering.

undefined/true/false

MovieClip.tabEnabled

Indicates whether a movie clip is included in tab ordering.

undefined/true/false

MovieClip.tabIndex

Indicates the tab order of an object.

undefined/positive integer

MovieClip._target

The target path of a movie clip instance.

object path

MovieClip._totalframes

The total number of frames in a movie clip instance.

positive integer

MovieClip.trackAsMenu

Indicates whether other buttons can receive mouse release events.

true/false

MovieClip._url

The URL of the SWF file from which a movie clip was downloaded.

text

MovieClip.useHandCursor

Determines whether the hand is displayed when a user rolls over a button movie clip.

true/false

MovieClip._visible

A Boolean value that determines whether a movie clip instance is hidden or visible.

true/false

MovieClip._width

The width of a movie clip instance, in pixels.

integer

MovieClip._x

The x coordinate of a movie clip instance

integer

MovieClip._xmouse

The x coordinate of the cursor within a movie clip instance.

integer

MovieClip._xscale

The value specifying the percentage for horizontally scaling a movie clip.

0 to 100

MovieClip._y

The y coordinate of a movie clip instance.

integer

MovieClip._ymouse

The y coordinate of the cursor within a movie clip instance.

integer

MovieClip._yscale

The value specifying the percentage for vertically scaling a movie clip.

0 to 100

 

 

all materials on this web site © copyright 2004, Philip van Allen

top