# Slide an object upon click

**URL:** https://forum.kirupa.com/t/slide-an-object-upon-click/220466
**Category:** Uncategorized
**Created:** [March 26, 2007, 5:58pm UTC](https://forum.kirupa.com/t/slide-an-object-upon-click/220466 "2007-03-26T17:58:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![imvain2](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/imvain2/32/620_2.png) [@imvain2](https://forum.kirupa.com/u/imvain2)
#### Post date: [March 26, 2007, 5:58pm UTC](https://forum.kirupa.com/t/slide-an-object-upon-click/220466/1 "2007-03-26T17:58:05Z")

</div>

I have the below function that is called when a button is clicked, however nothing happens. For testing purposes, I disabled all of the code within the function and get put in: iObject.\_y = EndPos; and that worked so I know the object is being passed correctly.

```auto

function SlideObjectDown(iObject,EndPos) {
   _root.onEnterFrame = function() {
   	   yMC = getProperty(iObject, _y);
	   moveMC = EndPos + yMC;
	   setProperty(iObject, _y, yMC + (moveMC/10));
    if (getProperty(iObject, _y)>=EndPos) {
         delete this.onEnterFrame;
      }
   };
}

```

Thanks for your help.
