# How to load image in movieclip Urgent Very Urgent

**URL:** <https://forum.kirupa.com/t/how-to-load-image-in-movieclip-urgent-very-urgent/209382>\
**Category:** Uncategorized\
**Created:** [December 8, 2006, 8:58am UTC](https://forum.kirupa.com/t/how-to-load-image-in-movieclip-urgent-very-urgent/209382 "2006-12-08T08:58:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nithysony](https://avatars.discourse-cdn.com/v4/letter/n/f6c823/32.png) [@nithysony](https://forum.kirupa.com/u/nithysony)\
**Post date:** [December 8, 2006, 8:58am UTC](https://forum.kirupa.com/t/how-to-load-image-in-movieclip-urgent-very-urgent/209382/1 "2006-12-08T08:58:12Z")

</div>

HI ,

I am having some n number of images.I want to alter the positions.I done the functionality.But if load the images it’s not working.I will give the whole code.Please help me.The images should be drag and drop

The code is

var xPos:Number =10;  
var yPos:Number = 10;  
var nofImage:Number = 5;  
var boolHit:Boolean = false;  
var arrImage:Array = new Array;  
var imgStr:String =“SOCCER-01.png,SOCCER-02.png,SOCCER-03.png,SOCCER-04.png,SOCCER-05.png,SOCCER-06.png”  
var imgArr:Array = new Array();  
imgArr = imgStr.split(",");  
var container;  
for(var i=0;i\<imgArr.length;i++){  
this.attachMovie(“blueMovie”,“blueMovie”+i,this.getNextHighestDepth());

this[“blueMovie”+i].loadMovie(imgArr\*)//“This is the line i load the image, without this line the movieclip is working fine.”

this[“blueMovie”+i].\_x = xPos ;  
this[“blueMovie”+i].\_y = yPos ;  
this[“blueMovie”+i].txt.text = imgArr\*;  
yPos = this[“blueMovie”+i].\_y + this[“blueMovie”+i].\_height + 80;  
this[“blueMovie”+i].ind = i;  
\_root.arrImage.push(i);  
this[“blueMovie”+i].onPress = function(){  
startDrag(this);  
xPos = this.\_x;  
yPos = this.\_y;  
this.swapDepths(\_root.nofImage+1);  
};  
this[“blueMovie”+i].onReleaseOutside = function(){  
stopDrag();  
this.\_x = xPos;  
this.\_y = yPos;  
}  
this[“blueMovie”+i].onRelease = function(){  
stopDrag();  
boolHit = false;  
for(var i=0;i\<imgArr.length;i++){  
if(this.ind != \_root[“blueMovie”+i].ind){  
if (this.hitTest(\_root[“blueMovie”+i])) {  
boolHit = true;  
xPos = 10;  
yPos = 10;  
var tempIns = \_root.arrImage.splice(this.ind,1);  
\_root.arrImage.splice(\_root[“blueMovie”+i].ind,0,tempIns);  
break;  
}  
}  
}  
if(\_root.boolHit == false){  
this.\_x = xPos;  
this.\_y = yPos;  
}  
else{  
for(var i=0;i\<\_root.arrImage.length;i++){  
\_root[“blueMovie”+\_root.arrImage\*].ind = i;  
\_root[“blueMovie”+\_root.arrImage\*].\_x = xPos;  
\_root[“blueMovie”+\_root.arrImage\*].\_y = yPos;  
yPos = \_root[“blueMovie”+\_root.arrImage\*].\_y + \_root[“blueMovie”+\_root.arrImage\*].\_height + 80;  
}  
}  
};  
}
