-
Slight bump
hello fellows actionscripters!
I have run into a small bump that I cant get around. I have written a code below to keep movie-clips moving when the one before it moves. It seems to make sense to me but i cant figure out why the for statement is only being applied to the last movie-clip (mc_5) and not the rest. i apprecciate your assistance!
PHP Code:
for ( var i:Number = 1; i<6; i++ ) {
var previousMc = _root["mc_"+(i-1)];
var thisMc = _root["mc_"+i];
trace("the current = "+thisMc);
trace("the previous = "+previousMc);
_root.onEnterFrame = function () {
if ( previousMc == undefined ) {
delete this.onEnterFrame;
} else {
thisMc._x = previousMc._x + 40;
}
}
}
No one will ever know how much you try, exept your self.. so suprize them.
-
No one will ever know how much you try, exept your self.. so suprize them.
-
I have them all working now but they all move to one spot? am i making sense to anyone? anyone have any suggestions?
PHP Code:
function activateMenu() { for ( var i = 1; i<6; i++ ) { var t = this["mc_"+i]; var tPosition = this["mc_"+(i-1)]._x; trace(tPosition); t.onEnterFrame = function () { this._x = tPosition; } } } activateMenu();
No one will ever know how much you try, exept your self.. so suprize them.
-
No one will ever know how much you try, exept your self.. so suprize them.
-
Well that's what your code tells them to do. You're saying "move to the position of the clip next to you", so clip2 moves to clip1, but clip3 also moves to clip1's position because that's where clip2 is.
What exactly do you want the clips to do? Are they all supposed to be moving in a row or something?
-
thanks for the reply man. But i got it to work now. i had to re arrange the onEnterFrame.
No one will ever know how much you try, exept your self.. so suprize them.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|