# \[FMX04\]: Problem with Events and loadMovie()

**URL:** <https://forum.kirupa.com/t/fmx04-problem-with-events-and-loadmovie/246786>\
**Category:** flash\
**Created:** [December 14, 2007, 3:30pm UTC](https://forum.kirupa.com/t/fmx04-problem-with-events-and-loadmovie/246786 "2007-12-14T15:30:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_E1](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Mr\_E1](https://forum.kirupa.com/u/Mr_E1)\
**Post date:** [December 14, 2007, 3:30pm UTC](https://forum.kirupa.com/t/fmx04-problem-with-events-and-loadmovie/246786/1 "2007-12-14T15:30:19Z")

</div>

Hello,

probably another noob-mistake. I want to create a button  
on-the-fly with actionscript. The following code works.  
I create a movieclip, draw a black rectangle and add an  
_onPress_ listener to it.

```auto

    _root.createEmptyMovieClip( "arrow_up", this.getNextHighestDepth());
    arrow_up.beginFill(0x000000, 100);
        arrow_up.moveTo(0, 0);
        arrow_up.lineTo(70, 0);
        arrow_up.lineTo(70, 51);
        arrow_up.lineTo(0, 51);
        arrow_up.lineTo(0, 0);
    arrow_up.endFill();
    
    _root.arrow_up._x = 400;    
    _root.arrow_up._y = 283;
    
    _root.arrow_up.onPress = function() {
        trace ("pressed");
    }

```

What I do not understand is why the following code  
does **not** work. I load a JPG instead of drawing some-  
thing - but then the _onPress_ event does not work  
anymore.

```auto

    _root.createEmptyMovieClip( "arrow_up", this.getNextHighestDepth());    
    _root.arrow_up.loadMovie( "img/wdp_arrow_up.jpg" );
    
    _root.arrow_up._x = 400;    
    _root.arrow_up._y = 283;
    
    _root.arrow_up.onPress = function() {
        trace ("pressed");
    }

```

Anyone any ideas or explanations ???

Cheers,Mr E
