A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: MC duplicates but only 1 time

  1. #1

    MC duplicates but only 1 time

    I need a continuous loop for this image viewer.

    I'm using Flash MX

    I have a MC that you scroll using buttons. It scrolls left, right and when the end of the MC enters the frame it duplicates so it appears to continue scrolling. The problem is it only duplicate one time the it will disappear out of frame if you continue to scroll.

    I want it to keep duplicating and scrolling.

    This is the actions I have for my buttons:

    // left
    on (rollOver) {
    _root.pic2.left = true;
    }
    on (rollOut) {
    _root.pic2.left = false;
    }

    // right
    on (rollOver) {
    _root.pic2.right = true;
    }
    on (rollOut) {
    _root.pic2.right = false;
    }

    And this is the actions for my MC:

    onClipEvent (load) {
    mode = true;
    speed = 10;
    //
    function go(degree) {
    _y -= speed;
    _x += speed;
    }
    }
    onClipEvent (enterFrame) {
    //
    if (mode) {
    if (up) {
    _y -= speed;
    }
    if (down) {
    _y += speed;
    }
    if (right) {
    _x += speed;
    }
    if (left) {
    _x -= speed;
    }
    }
    //
    // Duplicate MC
    }
    onClipEvent (load) {
    pic1.duplicateMovieClip("pic2", 100);
    pic2._x = pic1._x+pic1._width;
    pic1Startx = this._x;
    pic1Speed = 10;
    }
    onClipEvent (load) {
    pic1.duplicateMovieClip("pic2", 50);
    pic2._x = pic1._x-pic1._width;
    pic1Startx = this._x;
    pic1Speed = 10;
    }

    This has been put together from deconstruted FLA. files and help from the great people on this site. So sayin add this or try if, else dose'nt help, I might need more explanation than most or show me where to add it in the code.

    I am attaching a sample to better explain what I am trying to do.

    Thanks for all the help so far,
    Attached Files Attached Files

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    try using a name other than "pic2" for your second one.

  3. #3
    That didn't work. I think pic2 is the duplicate of the parent pic1.

  4. #4
    I got one side working, the left button when moused over scrolls and scrolls and scroll as it should. However the right button continues to only duplicate one time. I think I need to change a - to a + somewhere.

    Here is the new code for the MC:

    onClipEvent (load) {
    mode = true;
    speed = 10;
    //
    function go(degree) {
    _y -= speed;
    _x += speed;
    }
    }
    onClipEvent (enterFrame) {
    //
    if (mode) {
    if (up) {
    _y -= speed;
    }
    if (down) {
    _y += speed;
    }
    if (right) {
    _x += speed;
    }
    if (left) {
    _x -= speed;
    }
    }
    //
    // loop to opposite side of the masked area when the beetle travels off-screen
    }
    onClipEvent (load) {
    pic1.duplicateMovieClip("pic2", 100);
    pic2._x = pic1._x+pic1._width;
    pic1Startx = this._x;
    pic1Speed = 10;
    }
    onClipEvent (enterFrame) {
    if (this._x<=(pic1Startx-pic1._width)) {
    this._x = pic1Startx-pic1Speed;
    }
    }
    onClipEvent (load) {
    pic1.duplicateMovieClip("pic2", 0);
    pic2._x = pic1._x-pic1._width;
    pic1Startx = this._x;
    pic1Speed = 10;
    }
    onClipEvent (enterFrame) {
    if (this._x<=(pic1Startx-pic1._width)) {
    this._x = pic1Startx-pic1Speed;
    }
    }


    I updated the sample as well.

    Thanks,
    Attached Files Attached Files

  5. #5
    anyone?

  6. #6
    :
    Join Date
    Dec 2002
    Posts
    3,518

    Maybe something like this...?

    See attached file
    Last edited by dawsonk; 08-22-2007 at 10:52 AM.

  7. #7
    WOW!

    Thats awsome!

    Now I want to have a few different pics do this. Can I use buttons with go to and stop frame 2. Then use the same code with the new pics instance, say hold 3.

  8. #8
    Hey I got this thing working using your awsome sample. However I am having trouble with the Up and Down. I have played with some of the numbers but I am not sure which ones control that part. Can you show me where to adjust the Up and Down?

    I have attached another sample that is the actual size I am working with.

    Thanks for everything!
    Attached Files Attached Files

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