# AS2: \*\*movieclip button\*\*

**URL:** <https://forum.kirupa.com/t/as2-movieclip-button/288940>\
**Category:** flash\
**Created:** [May 23, 2009, 4:23pm UTC](https://forum.kirupa.com/t/as2-movieclip-button/288940 "2009-05-23T16:23:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adiosamigos](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@adiosamigos](https://forum.kirupa.com/u/adiosamigos)\
**Post date:** [May 23, 2009, 4:23pm UTC](https://forum.kirupa.com/t/as2-movieclip-button/288940/1 "2009-05-23T16:23:45Z")

</div>

Hi

I have created a movieclip that i am using as a button. The movieclip is inside another movieclip and i use an attachMovie script to add it.

The actionscript that for this is in the timeline:

//attaches movieclip  
container.attachMovie(“next”, “nextbutton”, 1);

//what the movieclip does as a button  
container.nextbutton.onRelease = function(){  
container.attachMovie(“input”, “input”, 2, {\_y:0});  
container.nextbutton.removeMovieClip();  
container.attachMovie(“next”, “nextbutton”, 3, {\_y:45});  
}

The problem is when i use removeMovieClip and reattach the same movieclip it loses it’s button like properties.

I need to know how i can put the actionscript inside the movieclip itself without refrence to it from the timeline and i don’t know how to do that.

Any help is really appreciated.

Thanks, Tom
