I’m just starting out on a very basic ActionScript self-study program. I’m doing an exercise from a book, and it doesn’t work the way it’s supposed to. Here’s the code:
var ball1Clip:MovieClip;
ball1Clip = _level0.createEmptyMovieClip("ball1_mc", 1);
var ball2Clip:MovieClip = myMC1.duplicateMovieClip("ball2_mc", 2);
ball1Clip._x = 100;
ball2Clip._x = 200;
trace(ball1Clip._x); // outputs: 100;
trace(ball2Clip._x); // SHOULD output: 200, instead returns: undefined
It’s supposed to create a copy of “ball1Clip”, rename it “ball2Clip”, move it to x 200 and then output their respective x coordinates. For some reason, it doesn’t and I’m pretty sure that I copied it verbatim from the book (I’m getting a little tired of looking at it). I found an error on the code right before this exercise (it told me to write “trace(ball1._x)” instead of “trace(ball1Clip._x)”) so I’m getting worried that this book wasn’t proofed as well as it should have been. I really don’t want to keep moving forward until I’ve resolved this. Can anyone point out what’s wrong?
EDIT: Never mind, found the publisher’s errata page for this book. instead of “myMC1” it should be “ball1Clip”, which makes more sense.