# I've integrated to sets of code - very badly

**URL:** <https://forum.kirupa.com/t/ive-integrated-to-sets-of-code-very-badly/31124>\
**Category:** Uncategorized\
**Created:** [September 18, 2003, 3:14pm UTC](https://forum.kirupa.com/t/ive-integrated-to-sets-of-code-very-badly/31124 "2003-09-18T15:14:07Z")\
**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 18, 2003, 3:14pm UTC](https://forum.kirupa.com/t/ive-integrated-to-sets-of-code-very-badly/31124/1 "2003-09-18T15:14:07Z")

</div>

Please take a look at this. Trying to integrate preloader code to this loadMovie code. Not done properly obviously…but how to I do it?

square.\_alpha = 0;  
whichPic = 1;  
this.createEmptyMovieClip(“preloader”, 1000);

next.onPress = function() {  
if (whichPic\<5 && !fadeIn && !fadeOut) {  
fadeOut = true;  
whichpic++;  
input = whichPic;  
}  
};  
back.onPress = function() {  
if (whichPic\>1 && !fadeIn && !fadeOut) {  
fadeOut = true;  
whichpic–;  
input = whichPic;  
}  
};  
\_root.onEnterFrame = function() {  
// when a new Photo is selected, fade out, load new image, and fade in  
if (square.\_alpha\>10 && fadeOut) {  
square.\_alpha -= 10;  
}  
if (square.\_alpha\<10) {  
loadMovie("…/images/image"+whichPic+".jpg", “square”);  
square.\_visible = false;  
fadeOut = false;  
fadeIn = true;  
}  
preloader.onEnterFrame = function() {  
var l = square.getBytesLoaded();  
var t = square.getBytesTotal();  
var getPercent = l/t;  
loadText = Math.round(getPercent_100)+"%";  
loadBar.\_width = getPercent_100;  
if (l\>0 && l\>=t) {  
square.\_visible = 1;  
delete this.onEnterFrame;  
}  
};  
if (square.\_alpha\<100 && fadeIn && !fadeOut) {  
square.\_alpha += 10;  
} else {  
fadeIn = false;  
}  
};
