0

I have here 4 movieclips that are on main stage, and 5 movie clips inside one of the movie clips

btn_mc5 to btn_mc9 are within content_mc I added event listener,but they are not doing anything. Also, they are producing an error message starting on line "content_mc.btn_mc5.addEventListener(MouseEvent.MOUSE_DOWN, btn5up);" :

TypeError: Error #1010: A term is undefined and has no properties. at Untitled_fla::MainTimeline/frame2()

import flash.events.MouseEvent;

stop();

btn_mc1.gotoAndStop(2);
btn_mc2.stop();
btn_mc3.stop();
btn_mc4.stop();

content_mc.stop();

btn_mc1.addEventListener(MouseEvent.MOUSE_DOWN, btn1up);
btn_mc2.addEventListener(MouseEvent.MOUSE_DOWN, btn2up);
btn_mc3.addEventListener(MouseEvent.MOUSE_DOWN, btn3up);
btn_mc4.addEventListener(MouseEvent.MOUSE_DOWN, btn4up);

content_mc.btn_mc5.addEventListener(MouseEvent.MOUSE_DOWN, btn5up);
content_mc.btn_mc6.addEventListener(MouseEvent.MOUSE_DOWN, btn6up);
content_mc.btn_mc7.addEventListener(MouseEvent.MOUSE_DOWN, btn7up);
content_mc.btn_mc8.addEventListener(MouseEvent.MOUSE_DOWN, btn8up);
content_mc.btn_mc9.addEventListener(MouseEvent.MOUSE_DOWN, btn9up);

function btn1up(event:MouseEvent):void{
    content_mc.gotoAndStop(1);
    reset();
    btn_mc1.gotoAndStop(2);
}
function btn2up(event:MouseEvent):void{
    content_mc.gotoAndStop(2);
    reset();
    btn_mc2.gotoAndStop(2);
}
function btn3up(event:MouseEvent):void{
    content_mc.gotoAndStop(3);
    reset();
    btn_mc3.gotoAndStop(2);
}
function btn4up(event:MouseEvent):void{
    content_mc.gotoAndStop(4);
    reset();
    btn_mc4.gotoAndStop(4);
}
function btn5up(event:MouseEvent):void{
    content_mc.gotoAndStop(1);
    content_mc.btn_mc5.gotoAndStop(1);
}
function btn6up(event:MouseEvent):void{
    content_mc.gotoAndStop(6);

}
function btn7up(event:MouseEvent):void{
    content_mc.gotoAndStop(7);
}
function btn8up(event:MouseEvent):void{
    content_mc.gotoAndStop(8);
}
function btn9up(event:MouseEvent):void{
    content_mc.gotoAndStop(9);
}

function reset():void{
    for(var i = 1; i<= 4; i++){
        var btn_name = getChildByName("btn_mc"+i);
        btn_name.gotoAndStop(1);
        }
}
Engineer
  • 47,849
  • 12
  • 88
  • 91
jko
  • 133
  • 1
  • 7
  • 14
  • How did you add btn_mc5 to conetnet_mc. The error means btn_mc5 is not inside of content_mc. Can you post some more code? – francis Apr 07 '12 at 00:29
  • I believe mouse down is a bubbling event, so you may want to consider just adding the one mouse handler and filtering on what the mouse landed on. You might also want to consider having content_mc listen to the events and "translate" them to your own events that have more meaning. – Amy Blankenship Apr 07 '12 at 02:30

0 Answers0