# Onpress/attachmovie issues

**URL:** <https://forum.kirupa.com/t/onpress-attachmovie-issues/226186>\
**Category:** Uncategorized\
**Created:** [May 18, 2007, 5:22pm UTC](https://forum.kirupa.com/t/onpress-attachmovie-issues/226186 "2007-05-18T17:22:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![camupod](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/camupod/32/2903_2.png) [@camupod](https://forum.kirupa.com/u/camupod)\
**Post date:** [May 18, 2007, 5:22pm UTC](https://forum.kirupa.com/t/onpress-attachmovie-issues/226186/1 "2007-05-18T17:22:31Z")

</div>

so I wrote this chunk of code as a test to see if my other one should work:

```auto
var mc:MovieClip = _root.createEmptyMovieClip("mc", 800+id );
mc.createTextField( "txt", 800+id, 0, 50, 320, 20 )

with (_root.mc.txt ){
    text = "text";
    autoSize = "center";
    selectable = false;
    type = "dynamic";
}

with ( _root.mc ){
    attachMovie( "template", "t", this.getNextHighestDepth() );
    t._x = 180;
    t._y = 200;
    t.onPress = function( ){
        trace("something");
    };
}
         

```

which works fine… you press the button and it traces “something”.

then I have this:

```auto

_root.formats_mc[id+"_quality_mc"] = _root.formats_mc.createEmptyMovieClip( id+"_quality_mc", 800+id ); //id is just a unique id for each movieclip that is created

xStart = 162;
yStart = 40+prev_y_format;
        
with( _root.formats_mc[id+"_quality_mc"] ){
      attachMovie( "template", "btn", 1000+id );
      btn._x = xStart;
      btn._y = yStart;

      btn.onPress = function( ){
           trace("something");
      };
} //end with

```

the button shows up in the right place, but you can’t press it.  
so basically, using the debugger, I see that btn.onPress is included in the variables of the movieclip \_root.formats\_mc[id+"\_quality\_mc"].btn, but it is not getting defined for some reason. btn.\_y and .\_x work fine, so what’s the deal?
