A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: How to - duplicateMovieClip

  1. #1
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870

    How to - duplicateMovieClip

    I made a pop-up window, and now what i need is a special sort of thing to attach (or duplicate) the window onto the screen. The window's instance name is window and its export name is window_x.
    so how do I attach the movieclip into the main movie?

    Regards,
    Tongxn

    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    I think you are looking for _root.attachMovie();
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  3. #3
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    O - K.. so what do I use in the ()?
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  4. #4
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    First is the linkage name, you can do that by selecting the object in the library and right clicking it. Then in the menu select linkage. With the pop-up up check the first box. Then in the text box above it type in a easy name to remember.

    Back to the code, _root.attachMovie("Linkage name", new name, _root.getNextHighestDepth());

  5. #5
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    mmm so how could I create different new names everytime...
    is it by putting a variable up? like if i set a

    var pi = 1;
    _root.attachMovie("link" , link + "pi" , _root.getNextHighestDepth()) ;
    pi += 1;

    would that work?
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  6. #6
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Yes, you could create a new variable. Your example is pretty close, instead of having the pi+=1 after the attach it should be before it.

    pi+=1
    _root.attachMovie("link", "newName"+pi, _root.getNextHighestDepth());

  7. #7
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    ah thank you all for your time..
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  8. #8
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    ahh.. i got another problem.
    this is my preloader's actionscript:

    // percentDone is a var for a dynamic textbox
    var bytestotal = _root.getBytesTotal();
    var bytesloaded = _root.getBytesLoaded();
    if (bytesloaded == bytestotal) {
    gotoAndPlay(5);
    } else {
    play();
    }
    percentDone = int((loadedbytes/totalbytes)*100);

    now that don't seem to work at all, and I checked up everything i could use to make percentDone show the % that is done!?

    so what is the problem? i copied this AS from one of my template preloaders and linked up everything to it but it's not working.

    Regards,
    Tongxn

    p.s. is it ok to post another topic in here coz i don't want to add another thread...?
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  9. #9
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Not a problem at all. As for your other question, I haven't really played around with pre-loaders. But from what I can tell on the code you have written I kinda see a mistake.

    percentDone = int((loadedbytes/totalbytes)*100); shouldn't you change the variables

    percentDone = int((bytesloaded/bytestotal)*100);

    I just noticed that from your variables above that line and they were different. Not sure if that could help out. You might to do a search on he topic in the forums or even in tutorials.

  10. #10
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    That might be it you are a GENIUS!
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  11. #11
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Please yet me know if that works or not?

  12. #12
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    yea it worked!
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  13. #13
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Awesome, it always seems to be the little things that mess stuff up.

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