0 Replies Latest reply on Dec 4, 2007 12:36 PM by Bob_Robertson

    Building a Parts Box; having trouble with DuplicateMovieClip

    Bob_Robertson Level 1
      Hey all. I'm on another project which involves dragging parts from a collection of spares, and dropping them on a grid elsewhere onscreen. Here's my implementation: each of the parts in the collection of spares is an invisible button shaped like the image of the part that it's placed over. The code on each of the buttons is near-identical, and attached below. When the user rolls over the button, a tooltip pops up; when they roll off, it goes away; when they click on the button, they should start dragging an instance of that part.

      Now, because each part has the same onPress and onRelease behavior, I had the bright idea of defining only one clip, assigning those behaviors to it, and then attaching each part clip to it. This seems to work well; the onPress and onRelease behaviors work fine.

      The trouble starts when I go back for another part. As soon as _root.originalPartHolder.duplicateMovieClip is called, the first part disappears, and I can't for the life of me figure out why. I don't mean "goes off-screen and I can't see it", or "minimizes the _alpha property", I mean disappears from the debugger altogether. It's like the new clip somehow overwrites the old one, or something like that. I've tried this using _root.attachMovie, as well, with very similar results.

      Can anyone please tell me what I'm doing wrong here? I'm entirely out of ideas.

      Many Thanks,
      Bob Robertson

      EDIT: I should perhaps add that I'm using AS2 and exporting for Flash Player 6.