Enter the following ActionScript in Frame 1 of the Timeline:
var pctLoaded:Number = Math.round(this.getBytesLoaded()/
this.getBytesTotal()*100);
bar_mc._xscale = pctLoaded;
Add the following code to Frame 2:
if (this._framesloaded<this._totalframes) {
this.gotoAndPlay(1);
} else {
this.gotoAndStop(3);
}
Place your content on or after Frame 3. Then add the following code to Frame 3:
stop();
See also
getBytesLoaded (MovieClip.getBytesLoaded method)
getDepth (MovieClip.getDepth method)
public getDepth() : Number
Returns the depth of the movie clip instance.
Each movie clip, button, and text field has a unique depth associated with it that determines
how the object appears in front of or in back of other objects. Objects with higher depths
appear in front.
You can extend the methods and event handlers of the MovieClip class by creating a subclass.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
- The depth of the movie clip.
Number
Example
The following code traces the depth of all movie clip instances on the Stage:
for (var i in this) {
if (typeof (this[i]) == "movieclip") {
trace("movie clip '"+this[i]._name+"' is at depth "+this[i].getDepth());
}
}
MovieClip
469
Need help?
Do you have a question about the FLASHLITE2 ACTIONSCRIPT-LANGUAGE and is the answer not in the manual?