A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: duplicateMovieClip

Hybrid View

  1. #1
    Junior Member
    Join Date
    Apr 2004
    Posts
    24

    duplicateMovieClip

    how do i implement duplicateMovieClip with this
    on (press) {
    startDrag(this);
    this.swapDepths(100);
    }

    ????

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    So you're saying you want to make it so then when you click on a symbol, it makes a copy of the symbol and then you're dragging that copied symbol around the stage, right?

    If so, try this:

    code:

    on(press)
    {
    var nd = _root.getNextHighestDepth();
    this.myLastMC = this.duplicateMovieClip('mc_'+nd, nd);
    this.myLastMC.startDrag();
    }

    on(release, releaseOutside)
    {
    this.myLastMC.stopDrag();
    }



    One of the potential problems with this method is that the movieclip you are copying inherits the scripts, so all the copied scripts can also be duplicated by clicking on them. If your intent is to make a 'toolbar' which makes 'objects', then this is probably not what you want. In that case, it would be better to use attachMovie (to copy a clip from the library) instead of duplicateMovieClip, so that the scripts don't get copied.
    Last edited by jbum; 10-18-2004 at 05:24 PM.

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