# Combining 2 scripts

**URL:** <https://forum.kirupa.com/t/combining-2-scripts/168022>\
**Category:** Uncategorized\
**Created:** [November 3, 2005, 9:04am UTC](https://forum.kirupa.com/t/combining-2-scripts/168022 "2005-11-03T09:04:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flyingzenmonkey](https://avatars.discourse-cdn.com/v4/letter/f/9e8a1a/32.png) [@flyingzenmonkey](https://forum.kirupa.com/u/flyingzenmonkey)\
**Post date:** [November 3, 2005, 9:04am UTC](https://forum.kirupa.com/t/combining-2-scripts/168022/1 "2005-11-03T09:04:52Z")

</div>

hi i need to combine these two scripte but have no iidiea how plaes help guys … thanks

(first one creates array to play movie clips in a order fro left to right of the screen depending on position ) each script works corectly if used on there own. but i want to combine them … any thoughts please

var videos:Array = new Array(“mc1”, “mc2”, “mc3”, “mc4”);  
var busy:Boolean = false;  
for(var i = 0; i\<videos.length; i++)  
{  
this[videos\*].onPress = function()  
{  
this.startDrag();  
}  
this[videos\*].onRelease = function()  
{  
this.stopDrag();  
}  
this[videos\*].stop();  
}  
function getNext()  
{  
var nextId:Number = 0;  
for(var i = 0; i\<videos.length; i++)  
{  
if(this[videos\*].\_x \<= this[videos[nextId]].\_x)  
{  
nextId = i;  
}  
}

this[videos[nextId]].play();  
videos.splice(nextId, 1);  
trace(videos);  
}  
btn\_play.onRelease = function()  
{  
if(busy)return;  
busy = true;  
getNext();  
}

the next is a shared object code to… save movie cliups position

stop();

function saveData() {  
myLSO = SharedObject.getLocal(“uniqueName”);  
if (myLSO.data.myObj == undefined) {  
// No object exists  
} else {  
}  
msg = “saved”;  
myObj = {};  
myObj.objArray = new Array();  
myObj.objArray[0] = \_root.mc1.\_x;  
myObj.objArray[1] = \_root.mc1.\_y;  
myObj.objArray[2] = \_root.mc2.\_x;  
myObj.objArray[3] = \_root.mc2.\_y;  
myObj.objArray[4] = \_root.mc3.\_x;  
myObj.objArray[5] = \_root.mc3.\_y;  
myObj.objArray[6] = \_root.mc4.\_x;  
myObj.objArray[7] = \_root.mc4.\_y;  
myObj.objArray[8] = \_root.mc5.\_x;  
myObj.objArray[9] = \_root.mc5.\_y;  
myLSO.data.myObj = myObj;  
}  
function loadData() {  
myLSO = SharedObject.getLocal(“uniqueName”);  
if (myLSO.data.myObj == undefined) {  
// No object exists  
msg = “nothing to load”;  
} else {  
\_root.mc1.\_x = myLSO.data.myObj.objArray[0];  
\_root.mc1.\_y = myLSO.data.myObj.objArray[1];  
\_root.mc2.\_x = myLSO.data.myObj.objArray[2];  
\_root.mc2.\_y = myLSO.data.myObj.objArray[3];  
\_root.mc3.\_x = myLSO.data.myObj.objArray[4];  
\_root.mc3.\_y = myLSO.data.myObj.objArray[5];  
\_root.mc4.\_x = myLSO.data.myObj.objArray[6];  
\_root.mc4.\_y = myLSO.data.myObj.objArray[7];  
\_root.mc5.\_x = myLSO.data.myObj.objArray[8];  
\_root.mc5.\_y = myLSO.data.myObj.objArray[9];  
msg = “loaded”;  
}  
}  
save.onRelease = function() {  
saveData();  
};  
load.onRelease = function() {  
loadData();  
};
