I’ve got the following code:
function reshuffle() {
plank0_mc.removeMovieClip();
plank1_mc.removeMovieClip();
plank2_mc.removeMovieClip();
plank3_mc.removeMovieClip();
plank4_mc.removeMovieClip();
plank5_mc.removeMovieClip();
plank6_mc.removeMovieClip();
temp_array = [];
for (i=0; i<8; i++) {
clip = "plank"+i + "_mc";
trace(clip);
temp_array.push(clip);
}
temp_array.sort(function () {
return random(2) ? true : false;
});
for (i=0; i<8; i++) {
mcName = temp_array*
X = 100;
Y = (40*i)+50;
_root.attachMovie(mcName,mcName,_root.getNextHighestDepth(),{_x:X, _y:Y});
}
}
Which is great and reshuffles my planks but then I try and use each plank as a drag and drop with the following code:
plank0_mc.onPress = function() {
startDrag(this);
this._rotation = 90;
};
But it doesn’t make an on press! Is there something you have to do to refer to a movieclip that has been put on stage by attachMovie?