# \_root. vs this. - Someone to check this code

**URL:** <https://forum.kirupa.com/t/-root-vs-this-someone-to-check-this-code/31406>\
**Category:** flash\
**Created:** [September 22, 2003, 3:28pm UTC](https://forum.kirupa.com/t/-root-vs-this-someone-to-check-this-code/31406 "2003-09-22T15:28:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedaykin](https://avatars.discourse-cdn.com/v4/letter/f/6de8d8/32.png) [@fedaykin](https://forum.kirupa.com/u/fedaykin)\
**Post date:** [September 22, 2003, 3:28pm UTC](https://forum.kirupa.com/t/-root-vs-this-someone-to-check-this-code/31406/1 "2003-09-22T15:28:45Z")

</div>

Hi,

I’m trying to load a jpeg, display a text preloader then fade in the image. I can get the preloader working but when I tack on the call to the fadeIn function at the end all I see is the fade and no preload. What am I doing wrong here?

I’ve got the following code:

on frame 1

//variables  
var series = “p”;  
var index = 1;  
var totalFiles = 22;  
loadMovie("…/images/"+series+"/image"+index+".jpg", “container”);  
fadeIn = function () {  
if (container.\_alpha\<=100) {  
container.\_alpha += 5;  
}  
};

same frame different layer

stop();  
container.\_visible = false;  
this.onEnterFrame = function ()  
{  
var l = container.getBytesLoaded();  
var t = container.getBytesTotal();  
var getPercent = l / t;  
loadText = "Photo loading… " + Math.round(getPercent \* 100) + “%”;  
if (l \> 0 && l \>= t)  
{  
container.\_visible = 1;  
loadText = “”;  
container.\_alpha = 0;  
\_root.onEnterFrame = fadeIn ;  
}  
}
