I have this MC called “notes” which is contained inside another MC called “score”.
therefore, “notes” can be called by using:
_root.score.notes right?
“notes” contains this code:
onClipEvent (load) {
pos=random(17)+1;
if (pos==1)
gotoAndStop(1);
else if (pos==2)
gotoAndStop(2);
else if (pos==3)
gotoAndStop(3);
else if (pos==4)
gotoAndStop(4);
else if (pos==5)
gotoAndStop(5);
else if (pos==6)
gotoAndStop(6);
else if (pos==7)
gotoAndStop(7);
else if (pos==8)
gotoAndStop(8);
else if (pos==9)
gotoAndStop(9);
else if (pos==10)
gotoAndStop(10);
else if (pos==11)
gotoAndStop(11);
else if (pos==12)
gotoAndStop(12);
else if (pos==13)
gotoAndStop(13);
else if (pos==14)
gotoAndStop(14);
else if (pos==15)
gotoAndStop(15);
else if (pos==16)
gotoAndStop(16);
else if (pos==17)
gotoAndStop(17);
}
Basically it just makes the clip go to and stop at a random frame. (each frame has a different graphic).
Now, in the “score” MC, I have some code on the first frame on a new layer which I called “actions”:
secondly, if you are IN score, you dont HAVE to reference clips there from _root i.e. in score: notes
is the same as _root.score.notes
This is because you are already in score so you dont have to complicate things by referencing things all the way from _root, Back into score and then to your object
thirdly, and here is your problem, frame events on the main timeline execute BEFORE onClipEvent(load) events on movieclips. Because of this, your pos variables in your note clips arent even defined yet meaning you get nothing when you try to reference them. What you might want to do instead is have that pos definition right there in the frame so its run before your note signing. With the if/else mess replacement, its not as big of a deal as it would have been before
now you know at least dont worry about it… the more you use it the better you’ll get and the esier things will come to you. You’ll catch on to things and things will eventually star making sense…
A good thing to do is to go through the tutorials, even if they are things you dont need to know. The thing is they can offer insights into coding styles and other non specific ways to help you easily achieve a mundane task such as the random pos and gotoAndStop. Flash can be tricky; it just takes some experience to know what booby-traps exist and how not to fall into them.
ok whats going on is the pos in the gotoAndStop is not the right pos… actually its no pos. What you need (which I just neglected in my copy and pasting of your old code ;)) is to include that clips name because the pos variable resides inside that clip. ie.