PDA

View Full Version : Position MC on stage



ukko
April 9th, 2009, 07:03 AM
I have 9 MC on stage with an instance of S1 to S9.

what I am try to do is position each clip beside each other on the x coordinate.

in AS2 it would be something like this



for (var d:Number = 0; d<9; d++) {
this["S"+d]._x = this["S"+d]._x -this["S"+d]._width/2
}


cheers guys

here's my code so far

AS3 code


for (var d:Number = 0; d<9; d++) {
var stamp_mc:MovieClip = new MovieClip();
stamp_mc.name = "S" + d;
//evt.target.x = stamp_mc.x;
stamp_mc.x = stamp_mc.x - stamp_mc.width/1;
trace(stamp_mc.x);
}

senocular
April 9th, 2009, 09:44 AM
Your AS3 code isn't going to work since you're creating new movie clips that you're moving around on the screen rather than the ones you already have up there. Why didn't you stick with your original approach?

for (var d:int = 0; d<9; d++) {
this["S"+d].x = this["S"+d].x -this["S"+d].width/2;
}