In short, here is what I'd like to accomplish:
- Click Movie Clip, add child
- Click child movie clip, play sound
- Click child again, stop sound
- Click child a third time, remove child
Sadly, I've only gotten as far as step 1. I've figured out how to get a sound to play when the parent movie clip is clicked (I'm using linkage), but when I attempt the same after with the child, I get the following error:
TypeError: Error #1010: A term is undefined and has no properties. (I'm no longer getting this error)
Scene 1, Layer 'actions', Frame 1, Line 29 1120: Access of undefined property newBox.
leftBox.addEventListener(MouseEvent.CLICK, addBox); function addBox(event:MouseEvent):void { var newBox:right_box = new right_box(); addChild(newBox); newBox.x = 0; newBox.y = 0; newBox.width = leftBox.width; newBox.height = leftBox.height /2; } newBox.addEventListener(MouseEvent.CLICK, playSound); function playSound(event:Event) { var mySound:testSound = new testSound(); mySound.play(); }
Any help would be much appreciated.
Thanks!
(P.S. I'm a n00b, so please, be nice!)