Ok heres my code pretty well commented I think…
Heres the problem… when its called just how it is it works fine but I am probably going to use this as an external swf and just to make it more portable etc I am trying to figure out how I can change the _level0.onEnterFrame function to a reference like “this” or “this._parent”
when I trace those you can see in the comments what the results were…
It has something to do with the fadeDelay object and using it with set interval… is there another way I can use setInterval or someway to call an indirect reference instead of a “direct reference”??? is there any other way to do this other than the way I have it???
MovieClip.prototype.loadPic = function(pic) {
//Calls the Pic Fade Out Prototype
picholder_mc.fadeOut();
//Creates the fadeDelay Object and defined all of the items needing processed after the delay
fadeDelay = new Object();
fadeDelay.interval = function() {
//Clear the interval timer
clearInterval(ID);
//Just makes sure the _alpha property is exactly 0
picholder_mc._alpha = 0;
//Self explanitory
picholder_mc.loadMovie(pic);
//"This" = [object Object] when traced hence the need to set the onEnterFrame to _level0
//"this._parent" = undefined
_level0.onEnterFrame = function() {
total = picholder_mc.getBytesTotal()
loaded = picholder_mc.getBytesLoaded();
bar._visible = 1;
border._visible = 1;
per = Math.round((loaded/total)*100);
//If its all loaded...
if (total == loaded) {
picholder_mc.fadeIn();
bar._visible = 0;
border._visible = 0;
loadText.text = "";
delete this.onEnterFrame;
//If not advance the preloader
} else {
bar._width = per;//gives the bar a max width 100
loadText.text = per+" % loaded";
}//End the If Else statement
}//End the _level0.onEnterFrame Function
}//End the fadeDelay.interval Function called by the line below this
//Sets and calls the interval after a set delay to allow the fadeOut to finish
ID = setInterval(fadeDelay,"interval",500);
}//End the loadPic Prototype
This works just like it is but I don’t think its good coding practice to use a direct reference to _level0.onEnterFrame I’d rather use this.onEnterFrame or something similar… I hope I explained myself well enough… thanks in advance guys n gals hopefully senocular, voets or scotty or someone can help me out here…