A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: duplication probs... from inside a MC to the mainstage

  1. #1
    I have a slight problem with duplicating a MC, this is why:
    I have a button inside a movieclip... by pressing this I duplicate the movieclip to a new location.
    These are my problems:

    1) The mc is duplicated right on top of the original, although I do set the new x and y property.

    2) How do I set the duplicated mc on the main stage (_level0) and not inside the mc?

    2) If I duplicate the new MC again, the original mc will be removed... but I want to duplicate the mc over and over again, by clicking the original or the new ones.

    3) This is a question... can't I just leave the depth the same as the main stage (_level0)?

    These are the codes I use:

    Main Stage, frame 1:

    Duplicate Movie Clip ("/object", "object"&x, x)
    Set Property ("object"&x, X Position) = GetProperty ( "/reverence", _x ) +25
    Set Property ("object"&x, Y Position) = GetProperty ( "reverence", _y ) -25
    Set Variable: "x" = x + 1

    So far, so good. I duplicated the original mc to the scene of action, placed it near a reverence (homebase) MC.

    Main Stage, frame 2: just a stop

    The MC, /object, inside a button:

    On (Release)
    Duplicate Movie Clip ("", "_level0/object"&/:x, x)
    Set Property ("object"&/:x, X Position) = GetProperty ( " ", _x ) +25
    Set Property ("object"&/:x, Y Position) = GetProperty ( " ", _y ) -25
    Set Variable: "/:x" = x + 1
    End On

    Here I tried to place the duplicated MC near the MC where it originated from... but this doesn't work: the x and y position is the same as the original.

    And ofcourse, as I mentioned, if I duplicate an MC out of this one the original one is removed!

    Anyone know what's going wrong?
    [Edited by rienk on 09-16-2000 at 03:16 PM]

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Posts
    597
    The problem is the line
    Duplicate Movie Clip ("", "_level0/object"&/:x, x)

    The "newname" parameter can not be a target ("_level0/object"&/:x). Since duplicated movies appear on top of other movies a target can not be specified.

    Let me know if you need more,

    Rich.

  3. #3

    Wink

    Thank you for your answer.
    So how do I set the duplicated mc on the main stage while I want to activate the duplication from within a MC (by a button)?

  4. #4
    Senior Member
    Join Date
    Mar 2000
    Posts
    597
    Change your script to

    On (Release)
    Duplicate Movie Clip ("", "object"&/:x, x)
    Set Property ("/object"&/:x, X Position) = GetProperty ( "", _x ) +25
    Set Property ("/object"&/:x, Y Position) = GetProperty ( "", _y ) -25
    Set Variable: "/:x" = x + 1
    End On

    Let me know if you need more,

    Rich.

  5. #5

    Unhappy

    I am sorry to bother you again but the problems still remain... the mc is duplicated on top of the original mc and when I try to duplicate one from inside the duplicated mc, he just vanishes. [sigh - never saw the word duplicate in one line before ]

    Now, I have got a new idea: duplicating the mc from the main stage itself (it will work for one game I'm working on, but not with the other), but then I'll need a way to get a target name by actionscripting. Is there a way with flash to ask for a mc's target name?

  6. #6
    Senior Member
    Join Date
    Mar 2000
    Posts
    597
    Yes use the property "_target" in a Get Property statement or directly by for example Set Variable "/:mctargetname" = _target

    Let me know if you need more,

    Rich.

  7. #7
    Yeah, I should have thought of that... thank you! I will ring the bell... euh, messageboard... whenever I stuble on some new problems.

    Rienk

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