# \[FlashCS3 - AS2.0\] Dynamically Loaded MovieClips Don't Respond to Mouse Events?

**URL:** <https://forum.kirupa.com/t/flashcs3-as2-0-dynamically-loaded-movieclips-dont-respond-to-mouse-events/258966>\
**Category:** flash\
**Created:** [April 29, 2008, 10:44pm UTC](https://forum.kirupa.com/t/flashcs3-as2-0-dynamically-loaded-movieclips-dont-respond-to-mouse-events/258966 "2008-04-29T22:44:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fwalters](https://avatars.discourse-cdn.com/v4/letter/f/d6d6ee/32.png) [@fwalters](https://forum.kirupa.com/u/fwalters)\
**Post date:** [April 29, 2008, 10:44pm UTC](https://forum.kirupa.com/t/flashcs3-as2-0-dynamically-loaded-movieclips-dont-respond-to-mouse-events/258966/1 "2008-04-29T22:44:10Z")

</div>

[COLOR=Red]I’m trying to place 5 instances of a horizontal line (mcLine) starting at 78% from the top of the Stage. This all works fine, but I want to be able to have these dynamically created MovieClip instances register mouse events and they don’t.

First the setup of the mcLine instances:[/COLOR]

var nFirstLineY:Number = (Math.round(Stage.height\*.78));  
var nLineSpace:Number = 22;  
var nWaitTime:Number = 1000;  
var nInterval:Number = setInterval (drawLine, nWaitTime);  
var nTimes:Number = 1;  
// drawLine function attaches Line movie clip instance, names it “line\_” + nTimes for instance name, and places it on next highest level (nTimes)

function drawLine()  
{  
_root.attachMovie(“mcLine”, "line_"+nTimes, nTimes, {\_x: 0, \_y: nFirstLineY, \_width: Stage.width});  
nFirstLineY += nLineSpace;  
nTimes ++;  
if (nTimes \>=6)  
{  
clearInterval (nInterval);  
}  
}

[COLOR=Red]Then, I’m just using the following to try and make the lines “vibrate” when rolled over by the mouse pointer, by frame-jumping to the appropriate part of the movie clip, like so:[/COLOR]

line\_1.onRollOver=LineVibrate;  
line\_2.onRollOver=LineVibrate;  
line\_3.onRollOver=LineVibrate;  
line\_4.onRollOver=LineVibrate;  
line\_5.onRollOver=LineVibrate;

function LineVibrate() {  
this.gotoAndPlay(“vibrate”);  
}

[COLOR=Red]If I place instances of the mcLine MovieClip on the stage and name them line\_1, line\_2, etc., the function LineVibrate works, but when I try to add the instances at run time as above, the LineVibrate function stops working.

Can anyone tell me what I’m missing here?  
[/COLOR]
