[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]