ActionScript MX

Just finished the tutorial from Friends Of Ed Foundations AS book. A simple duplicateMovieClip with a while loop and staggered instances linked to the distance of the mouse. I followed thru step for step but dont get the “exact” result in the book. My original instance was placed at the x,y coordinates (290,190) and according to the tutorial, the math equasion is designed to stem the effect from that center point. However, the result I’m getting looks off center awkward.

any thoughts???

here’s the code:

i=0
while(i<10){
i++;
duplicateMovieClip(particle_mc, “particle”+i+"_mc", i);
}

onEnterFrame = function(){
xDist = _xmouse - 290;
yDist = _ymouse - 190;
j=0;
while (j<10){
j++;
_root[“particle”+j+"_mc"]._x = 290 + (xDist * j/10);
_root[“particle”+j+"_mc"]._y = 190 + (yDist * j/10);
}
}

Add [AS]particle_mc._visible = false;[/AS] in the beginning of the AS so hide the original clip as it is being used for nothing but a clip to duplicate from you do not need to have it visible.

Thanks, that does work but I must say, I’m a bit worried if the book I’m studying is not accurate.

Oh well, study hard and rewrite the book!!

Thanks again

It works fine, either you missed that line, or they just didn’t add it as they assumed you knew already, or maybe in the text they tell you to create the clip outside the visible stage area.

Friends of Ed books aren’t usually for beginner scripters and making the original clip invisible or putting it outside the visible stage area is something you should aways do when using duplicateMovieClip().