Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding event listener to a movieclip that is inside a movie clip
    text
    copied!<p>I have here 4 movieclips that are on main stage, and 5 movie clips inside one of the movie clips </p> <p><code>btn_mc5</code> to <code>btn_mc9</code> are within <code>content_mc</code> I added event listener,but they are not doing anything. Also, they are producing an error message starting on line "<code>content_mc.btn_mc5.addEventListener(MouseEvent.MOUSE_DOWN, btn5up);</code>" :</p> <blockquote> <p>TypeError: Error #1010: A term is undefined and has no properties. at Untitled_fla::MainTimeline/frame2()</p> </blockquote> <pre><code>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&lt;= 4; i++){ var btn_name = getChildByName("btn_mc"+i); btn_name.gotoAndStop(1); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload