462
ActionScript classes
Example
The following example duplicates a newly created MovieClip a number of times and traces
the target for each duplicate.
var container:MovieClip = setUpContainer();
var ln:Number = 10;
var spacer:Number = 1;
var duplicate:MovieClip;
for(var i:Number = 1; i < ln; i++) {
var newY:Number = i * (container._ spacer);
duplicate = container.duplicateMovieClip("clip-" + i, i, {_y:newY});
trace(duplicate); // _level0.clip-[number]
}
function setUpContainer():MovieClip {
var mc:MovieClip = this.createEmptyMovieClip("container",
this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 20;
mc.beginFill(0x333333);
mc.lineTo(w, 0);
mc.lineTo(w, h);
mc.lineTo(0, h);
mc.lineTo(0, 0);
mc.endFill();
return mc;
}
See also
loadMovie (MovieClip.loadMovie method)
,
removeMovieClip
(MovieClip.removeMovieClip method)
,
duplicateMovieClip function
enabled (MovieClip.enabled property)
public enabled :
Boolean
A Boolean value that indicates whether a movie clip is enabled. The default value of
enabled
is
true
. If
enabled
is set to
false
, the movie clip's callback methods and
on
action
event
handlers are no longer invoked, and the Over, Down, and Up frames are disabled. The
enabled
property does not affect the Timeline of the movie clip; if a movie clip is playing, it
continues to play. The movie clip continues to receive movie clip events (for example,
mouseDown
,
mouseUp
,
keyDown
, and
keyUp
).
Summary of Contents for FLASHLITE2 ACTIONSCRIPT-LANGUAGE
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...