Okay, i apologize if this was already covered in forums, but i could not find it right away. I am new to ActionScript II and I am trying to create a class to learn the in’s and out’s of AS II and i have stumpled into a bit of a problem i cannot resolve. Below is my class, the problem i am running into is on the monitorLoad() method… Take note of the traces, the first one gives me whatever i input into the class and the second one gets lost and traces undefined…so the problem I am running into has to do with where i create the empty movie clip…but i have no idea where i should create it in order to manipulate my loadBar_mov instance i will manually place on my stage…i realize using _root is not that dynamic and i probably should avoid it…but i dunno what else to do…any suggestions, or solutions? thanks in advance
class defaultTB {
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//default v1.0
//-----------------------------------------------------------------------------------------------
//!!! DISPLAY TEXT IS NOT DONE // NOT SURE _ROOT IS GOOD TO USE HERE
//This class is to be used to setup movie stage defaults, as well as control any other aspect that
//falls under the first frame, including preloader controls.
//
//Troy Blank 2006
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//VARIBALES
//-----------------------------------------------------------------------------------------------
public var loadBar_mov:MovieClip;
private var display_txt:MovieClip;
private var displayType:String;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//PARAMETERS
//-----------------------------------------------------------------------------------------------
//myMc ++ The instance name use to refer to the movie clip on the stage to act as a load bar
//myDT ++ The instance name used for the text box to display the custom text
//myDTy ++ Used to determine what type of custom display goes into text instance
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
public function defaultTB(myMc:MovieClip, myDT:MovieClip, myDTy:String) {
Stage.showMenu = false;
Stage.scaleMode = "noScale";
Stage.align = "TL";
loadBar_mov = myMc;
display_txt = myDT;
displayType = myDTy;
monitorLoad();
}
private function monitorLoad():Void {
trace(loadBar_mov);
_root.createEmptyMovieClip("preLoader_mov", 501);
_root.preLoader_mov.onEnterFrame = function() {
trace(loadBar_mov);
var theBytesLoaded = Math.round(_root.getBytesLoaded());
var theBytesTotal = Math.round(_root.getBytesTotal());
var getPercent = theBytesLoaded/theBytesTotal;
if (loadBar_mov != undefined) {
loadBar_mov._xscale = getPercent*100;
}
if (theBytesLoaded == theBytesTotal) {
gotoAndPlay(2);
removeMovieClip("preLoader_mov");
}
};
}
}