# How can I attach mouse events to dynamically created movieclips?

**URL:** <https://forum.kirupa.com/t/how-can-i-attach-mouse-events-to-dynamically-created-movieclips/258090>\
**Category:** flash\
**Created:** [April 20, 2008, 8:27pm UTC](https://forum.kirupa.com/t/how-can-i-attach-mouse-events-to-dynamically-created-movieclips/258090 "2008-04-20T20:27:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tibberous](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tibberous](https://forum.kirupa.com/u/tibberous)\
**Post date:** [April 20, 2008, 8:27pm UTC](https://forum.kirupa.com/t/how-can-i-attach-mouse-events-to-dynamically-created-movieclips/258090/1 "2008-04-20T20:27:48Z")

</div>

This isn’t working:

```php

function MOUSEUP(evt:MouseEvent):void {
    trace('=)');
} 

var test:MovieClip = new MovieClip();
test.graphics.beginFill(0xFF0000);
test.graphics.drawRect(0, 0, 300, 300);
test.addEventListener(MouseEvent.CLICK, MOUSEUP);
addChild(test);

```

And it’s on the main stage. Am I missing something?
