5 Replies Latest reply on May 16, 2008 1:13 PM by clbeech

    Seamless Movie Clips

    berelsonhotmail
      I'm trying to create a simple movie clip that makes a horizontal image appear as tho it's moving left to right on a cylinder and then reconnecting in a circular fashion. I call it a seamless movie clip. In my case, it would be clouds moving thru a window and continuously rotatign.

      The posting on the Adobe code samples http://www.adobe.com/devnet/flash/samples/interactivity_7/index.html shows a scrolling background which is manipulated by the user and much more complicated than i need. I've attached the code from this tutorial for easier reference. I'm assuming i can modify this code for my solution.

      I'm just looking for simple horizontal movement across the stage with no manipulation from the user. Again... it was way more complicated than i need.
        • 1. Re: Seamless Movie Clips
          clbeech Level 3
          really all you need here is a simple loop and two instances of the bg (or one that has repeated element positions) so place one instance on the stage at 0,0 then place another instance on the Stage aligned with the end(x) of the first instance. name them how you want, but for the example I'll use mc1 and mc2. now you jsut need a basic loop and some conditions that check to see if the instance has left the stage, if so, move it to the 'end' of the other clip. something like this:
          • 2. Seamless Movie Clips
            berelsonhotmail Level 1
            Thanks for the reply. Not quite there yet. i made a movie clip with a tween. The image is left aligned to stage in first frame and right aligned to stage on last frame. BTW, it's a seamless image, the far left and far right of the image match (just sky). Movie clip instance name on first frame is: "mc1" and on last frame is "mc2" . I did not use any of the code mentioned previously, i simply put your code in an actionscript layer on the first frame as indicated. Was i supposed to use bits and pieces of the earlier code or is your code selfcontained and sufficient for the movieclip?

            var speed = 10;

            onEnterFrame = function() {
            mc1._x -= speed;
            mc2._x -= speed;

            if(mc1._x+mc1._width<0) mc1._x=mc2._x+mc2._width;
            if(mc2._x+mc2._width<0) mc2._x=mc1._x+mc1._width;
            }

            Then i threw the whole movie clip on the main timeline but it doesn't work. I must be doing something wrong. Do i have to alter the width parameter from 0 to the length of the graphic in the movieclip i.e. 1500 for 1500 pixels long?
            • 3. Re: Seamless Movie Clips
              clbeech Level 3
              ok - first of all you don't need to use any Tweening with this method - this is for a 'static' image (although you can do this with a tween also if your images match up correctly, once the tween reaches the end of the cycle it will go back to the first frame - if the two positions match, you will get the same effect, and only be using a single image)

              the two instances should both be on the same frame(1) - you only need one frame - but the first should be at 0 (x) and the second should be aligned with the 'end' of the first to the right.

              yes the code above is all you need and should be placed in the first frame. no need to alter the code or the _width it will read that for you.
              • 4. Seamless Movie Clips
                berelsonhotmail Level 1
                Thank you for your patience and explicit instructions. This works now. Again... thanks.
                FYI... for anyone else reading this... this solution is compatible with Flash player 6 and up. It also worked in Flash MX.
                • 5. Re: Seamless Movie Clips
                  clbeech Level 3
                  you're welcome :)