mb8276,
[quoted text, click to view] > Just whatever gets the job done. I guess 1.0 or 2.0.
2.0, then. There are two goals, here: a) figure out when the end of
the movie is (or do you mean the end of the movie clip?) and b) animate a
progressive reduction in alpha over time.
The main timeline is a movie clip, just like any movie clip symbol, so
you can reference MovieClip class members against it. What are "class
members"? Good question, and the answer is pretty helpful. In
ActionScript, just about everything can be described in terms of an object,
and classes define those objects. The "MovieClip class" describes the
functionality available to all movie clip, the "TextField class" handles
dynamic and input text fields, the "Sound class" handles sounds, and so on.
Class entries, in the ActionScript 2.0 Language Reference, general feature
up to three categories: properties (charactersistics the object has),
methods (things the object can do), and events (things the object can react
to). So in a sense, they make great little "Owner's Manuals" for the object
in question.
In your case, if you want to fade out the movie clip when the main
timeline ends, you could *check* for an ending via ActionScript, but the
easiest approach would simply be to put your fade-out code on a keyframe
near the end of the main timeline. -- In which case, you might just be able
to use a tween to fade out that clip's Alpha property (see the Properties
inspector for that movie clip).
If you're checking on the end of the movie clip, make sure it has an
instance name (again, see the Properties inspector). Once that clip has a
name, you can reference it via ActionScript and apply MovieClip class
members to it. Assuming an instance name myClip, for example:
myClip._x = 500;
.... that would set the clip's horizontal position to 500 pixels in from the
left side of its parent (perhaps the Stage). You'll see the MovieClip._x
property in the MovieClip class entry of the documentation.
If you want to repeatedly check to see if the clip has finished playing
.... you could assign a function to its MovieClip.onEnterFrame event:
myClip.onEnterFrame = function():Void {
if (this._currentframe == this._totalframes) {
trace("done");
}
}
Again, you'll see the _currentframe and _totalframes properties in the
MovieClip class entry. They're characteristics of the object, so they're in
the Properties heading. Meanwhile, onEnterFrame is an event -- the movie
clip can react to each occurence of its entering a frame.
The if() statement lets you compare values. If the current frame is
equal to the last frame, badda boom. At that point, you can re-assign that
onEnterFrame handler to fade out the clip's _alpha as it enters each frame.
Finally, when _alpha is zero, you'd kill the event handler:
myClip.onEnterFrame = function():Void {
if (this._currentframe == this._totalframes) {
this.onEnterFrame = function():Void {
if (this._alpha > 0) {
this._alpha -= 10;
} else {
this._alpha = 0;
delete this.onEnterFrame;
}
};
}
};
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/ "Luck is the residue of good design."