# Movement with variable function (? what the)

**URL:** <https://forum.kirupa.com/t/movement-with-variable-function-what-the/159836>\
**Category:** Uncategorized\
**Created:** [August 20, 2005, 9:34pm UTC](https://forum.kirupa.com/t/movement-with-variable-function-what-the/159836 "2005-08-20T21:34:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![natronp](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@natronp](https://forum.kirupa.com/u/natronp)\
**Post date:** [August 20, 2005, 9:34pm UTC](https://forum.kirupa.com/t/movement-with-variable-function-what-the/159836/1 "2005-08-20T21:34:59Z")

</div>

i’m looping through xml, attaching mcs, etc…

that’s all working great. basically i’m making a drop down menu.

what i need is a function for the button that triggers the drop down which takes the dynamic height of the mc into consideration and drops the menu down (animates with actionscript) the appropriate amount.

here’s my actionscript:

```auto
stop();
myXml= new XML();
myXml.ignoreWhite=true;
myXml.onLoad=function(success){
	if(success){
		trace(this);
		myArray=myXml.firstChild.childNodes;
		trace(myArray);
		for(i=0; i<myArray.length; i++){
		holder._y= myArray.length*-24;
		dynHeight= myArray.length*24;
		item=holder.attachMovie("dynClip", "dynClip"+i, i, {_x:0, _y:(24*i)+1}) 
		item.name=myArray*.attributes.name;
		_root.dropButton.onRelease=function(dynHeight){}
		
	}
	}
}
myXml.load("menu.xml");
		

```

i’m not very adept at actionscripted movement yet so i was thinking of doing something like this:

```auto
_root.dropButton.onRelease=function(dynHeight){
for(j=0; j<dynHeight; j++){_root.holder._y--;}

```

obviously that ain’t right! Do i need to use setInterval somehow? anybody???
