2 Replies Latest reply on Jun 14, 2008 7:50 AM by Rick_Cope

    Duplicating Movie Clip problem

    Rick_Cope Level 1
      Hi anyone
      I'm trying to code a movie clip so when it is clicked a duplicate is created at a pre-defined location (callled origX and origY). I've tried adapting the code in the help files but, alas, no joy. Where am I going wrong (see attached code)
      "counter" is just a counter which increments each time the MovieClip is clicked and is added to the string representing the name of the latest instance of the movie clip.
      The "trace"s are just in there for testing, but reveal an 'undefined' for _x and _y for the new movieclip.
      Rick
        • 1. Re: Duplicating Movie Clip problem
          clbeech Level 3
          well a few things here - first you really should try to place your codes on the timeline rather than 'attaching' them to buttons or movieclip - there's reasons, and it's just a best practice. however there are just a few things your missing here:

          the first parameter in the duplicateMovieClip method should be a String not an Object - and unlike the attachMovie method the second parameter should be the depth assignment. additionally you can 'position' the clip within the call by using an Init Object in the call as a third param. if in fact orginX / Y are being read properly (without a path to _parent) then you could do the entire, and this code is 'attached' to the 'cow' MC - then you can use the following:
          • 2. Re: Duplicating Movie Clip problem
            Rick_Cope Level 1
            Thanks for your prompt reply cbeech, however, it is still not working. It appears to be creating a new movieclip called cow1 (as expected) but no new movieclip is appearing and I am still getting a 'trace' response of undefined cow1 x = undefined y = undefined.
            Any ideas? I'll try putting the code on the timeline to see if that makes any difference.
            Rick