# Problems addressing a button in a movie clip

**URL:** <https://forum.kirupa.com/t/problems-addressing-a-button-in-a-movie-clip/278957>\
**Category:** flash\
**Created:** [January 8, 2009, 12:35am UTC](https://forum.kirupa.com/t/problems-addressing-a-button-in-a-movie-clip/278957 "2009-01-08T00:35:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![watto\_uk](https://avatars.discourse-cdn.com/v4/letter/w/f08c70/32.png) [@watto\_uk](https://forum.kirupa.com/u/watto_uk)\
**Post date:** [January 8, 2009, 12:35am UTC](https://forum.kirupa.com/t/problems-addressing-a-button-in-a-movie-clip/278957/1 "2009-01-08T00:35:33Z")

</div>

Hi

I am trying to target a button contained within a movie clip that i am dynamically loading from the library. I am loading the clip with the following code,

var newClip:MovieClip = container\_mc(“container”);

function loadReservation ():Void  
{  
attachMovie(“container\_mc”, “container”, 0);  
removeMC(defaultContent\_mc);  
container.\_y = 150.8 ;  
container.\_x = 10;  
}

That loads the movie clip fine.

Then i am trying to target a button (closeResDetailsBtn) inside the container movie clip (that is now on stage). I have tried the following

container.closeResDetailsBtn.onRelease = function ()  
{  
trace(“its worked”);  
}

and

container\_mc.closeResDetailsBtn.onRelease = function ()  
{  
trace(“its worked”);  
}

neither option works, i have also tried creating a variable in my code for the button with

var newButton:Button = closeResDetailsBtn(“close”);

and using

close.onRelease = function ()  
{  
trace(“its worked”);  
}

Basiclly i need the button closeResDetailsBtn to close the container movie clip.  
Does anyone know what i am missing please?

Cheers

Liam.
