vineet  
                
                  
                    June 26, 2008,  6:13am
                   
                  1 
               
             
            
              hi everyone
i have seen this script mentioned on the below url
http://www.kirupa.com/developer/actionscript/moviecliploader2.htm 
i want to know how can i centre the position of the image that we load. all these three external images when load are loaded from left top corner.
i mean if i resize the images to less width and height they load from top left corner. i want them to load in the centre.
fla is attached
vineet
             
            
              
            
           
          
            
            
              search “stringy” he posted an fla recently with this code in I believe
             
            
              
            
           
          
            
              
                prg9  
              
                  
                    June 26, 2008,  2:12pm
                   
                  3 
               
             
            
              
Hi vineet, welcome to Kirupa!
Use 2 containers (ie: container & subContainer). Below is an example, replace your code with this modified code (same code just a few chnages for centering):
MovieClip.prototype.fadeIn = function() {
	this.onEnterFrame = function() {
		if (this._alpha < 100) {
			this._alpha += 10;
		} else {
			delete this.onEnterFrame;
		}
	};
};
bar._visible = false;
border._visible = false;
//
this.createEmptyMovieClip("container", this.getNextHighestDepth()); // ** Added
container.createEmptyMovieClip("subContainer", this.getNextHighestDepth()); // ** Added
container._x = Stage.width / 2; // ** Added
container._y = Stage.height / 2; // ** Added
//
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
	container._alpha = 0;
	bar._visible = true;
	border._visible = true;
	pText._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
	bar._width = (lBytes / tBytes) * 100;
	pText.text = "% " + Math.round((lBytes / tBytes) * 100);
};
preload.onLoadComplete = function(targetMC) {
	container.fadeIn();
	border._visible = false;
	bar._visible = false;
	dText._visible = false;
};
preload.onLoadInit = function(targetMC):Void  { // ** Added
	targetMC._x = 0 - targetMC._width / 2;
	targetMC._y = 0 - targetMC._height / 2;
};
//default image
my_mc.loadClip("pic1.jpg", container.subContainer); // ** Added
//buttons
button1.onPress = function() {
	my_mc.loadClip("pic1.jpg", container.subContainer); // ** Added
};
button2.onPress = function() {
	my_mc.loadClip("pic2.jpg", container.subContainer); // ** Added
};
button3.onPress = function() {
	my_mc.loadClip("pic3.jpg", container.subContainer); // ** Added
};
Thats a basic example using the code you had, hope it gets your going in the right direction :thumb:
             
            
              
            
           
          
            
              
                vineet  
              
                  
                    June 27, 2008,  8:35am
                   
                  4 
               
             
            
              [QUOTE=prg9;2349578]Hi vineet, welcome to Kirupa!
Use 2 containers (ie: container & subContainer). Below is an example, replace your code with this modified code (same code just a few chnages for centering):
MovieClip.prototype.fadeIn = function() {
	this.onEnterFrame = function() {
		if (this._alpha < 100) {
			this._alpha += 10;
		} else {
			delete this.onEnterFrame;
		}
	};
};
bar._visible = false;
border._visible = false;
//
this.createEmptyMovieClip("container", this.getNextHighestDepth()); // ** Added
container.createEmptyMovieClip("subContainer", this.getNextHighestDepth()); // ** Added
container._x = Stage.width / 2; // ** Added
container._y = Stage.height / 2; // ** Added
//
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
	container._alpha = 0;
	bar._visible = true;
	border._visible = true;
	pText._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
	bar._width = (lBytes / tBytes) * 100;
	pText.text = "% " + Math.round((lBytes / tBytes) * 100);
};
preload.onLoadComplete = function(targetMC) {
	container.fadeIn();
	border._visible = false;
	bar._visible = false;
	dText._visible = false;
};
preload.onLoadInit = function(targetMC):Void  { // ** Added
	targetMC._x = 0 - targetMC._width / 2;
	targetMC._y = 0 - targetMC._height / 2;
};
//default image
my_mc.loadClip("pic1.jpg", container.subContainer); // ** Added
//buttons
button1.onPress = function() {
	my_mc.loadClip("pic1.jpg", container.subContainer); // ** Added
};
button2.onPress = function() {
	my_mc.loadClip("pic2.jpg", container.subContainer); // ** Added
};
button3.onPress = function() {
	my_mc.loadClip("pic3.jpg", container.subContainer); // ** Added
};
Thats a basic example using the code you had, hope it gets your going in the right direction :thumb:[/QUOTE]
it was great to have your answer. it worked really as i wanted.
can u help with another thing based on same theory. this theory was for loading in levels.
now i have created the same thing but not in levels.
vineet