Using Parent Elements
Hello, for my class I must make a Ruth Goldberg machine and have it operated based on symbols(elements). This is what I have so far.

Here is the code I have so far:
Golf Tee Symbol Frame 1:
import flash.events.MouseEvent;
stop();
addEventListener(MouseEvent.CLICK,startAnimation);
function startAnimation(m:MouseEvent){
gotoAndPlay(2);
}
Golf Tee Symbol (Last Frame):
import flash.events.Event;
var e:Event = new Event("go");
dispatchEvent(e);
Ball Symbol Frame 1:
import flash.events.Event;
stop();
parent.getChildAt(parent.getChildIndex(this)-1).addEventListener("go",startAnimation);
function startAnimation(e:Event){
gotoAndPlay(2);
}
Ball Symbol (Last Frame):
import flash.events.Event;
var ev:Event=new Event("pop");
dispatchEvent(ev);
stop();
Ok, so right now the animation runs correctly. You click on the tee, and it hits the ball and the ball rolls into the hole and stops. Now I need to add another symbol, and I started out just testing how I would do that by having a rectangle move across the screen after the ball makes it in the hole, but nothing I try works. How would I move on?
I got some of the code from my professor but I'm not sure what the 2 represents in "gotoAndPlay(2);". I also don't understand the -1 in the parent symbol and how that would work when I add 8 more symbols. Finally, why does the dispatchEvent go from e to ev?
Any help would be appreciated my professor, I don't understand my professor!
