A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Slight bump

  1. #1
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115

    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 1i<6i++ ) {
            
            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.

  2. #2
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115
    anyone?
    No one will ever know how much you try, exept your self.. so suprize them.

  3. #3
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115
    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 
    1i<6i++ ) {
                
                var 
    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.

  4. #4
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115
    =(
    No one will ever know how much you try, exept your self.. so suprize them.

  5. #5
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    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?

  6. #6
    Senior Member
    Join Date
    Apr 2004
    Location
    Toronto
    Posts
    115
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center