duplicate MovieClip

Hello

I use the following function to duplicate a clip. I call this function several times in the film, but for the moment, whenever I call it, it reproduces very well, but replaces the previous copy while doing. I suspect it has to do with the new name of movie clip or the depth? If so, can someone help me with a work around?

script:
function printGeneric() {}
duplicateMovieClip (genericPrinter_mc.photoMaskGeneric_mc, "newPhoto_mc", this.getNextHighestDepth ());
}

Thank you very much

Ponch

Use genericPrinter_mc.getNextHighestDepth () to make sure that you do not use the same depth, but most probably you see just the new movieclip covering the duplicated movieclip and you only need to pass a new to see that the old man is always there.

Tags: Adobe Animate

Similar Questions

  • Duplicate movieclip that you made dynamically

    Gidday

    I have a class that has it above the constructor...

    public var mc:MovieClip = new MovieClip();

    ... and a function later gives him some graphics etc.

    In another function later, I want to make duplicates of 'mc' with different names, but I get the error:

    1046: type was not found or is not a constant of compilation: mc.

    var copies: int = 10;

    var y = 0;

    for (var i: int = 0; i < copies; i ++)

    {

    clone: mc var = new mc(); < < < < error here

    Clone.Name = 'clip' + i

    Clone.x = 0;

    Clone.y = y + 10;

    addChild (clone);

    }

    Why var clone does not recognize mc?

    I guess my question is - how to make copies of a movieclip created dynamically (as opposed to the related library in Flash Pro IDE)?

    Bravo guys

    To create an another jusat like him, you do exactly what yiou did, in the first place..., create an instance of the MoveClip and fill it with the same content you filled one with.

    When you try to deal with 'mc' as a class, 'mc' is not a class, it is an instance of MovieClip.

  • Repeat function for duplicate movieclip help please

    In my game, I have a button (fireBtn) that duplicates a movieclip of a fire.  I also have a button of water (waterBtn), which turns off the fire and remove the movieclip (s) dual fire.   Finally, there is a button 'Reset' (reset_mc) which removes the movieclip (s) on double fire and resets all other players.  Here is the code:

    Creates the fire


    {fireBtn.onPress = function ()}
    i ++ ;
    _root.fireMC.duplicateMovieClip ("fireMC" + I, i);
    }

    {waterBtn.onRelease = function ()}
    waterBtn._visible = false;
    }

    Fades and deletes the fire


    waterBtn.onPress = fadeOut;

    function fadeOut() {}
    fireMC1.onEnterFrame = function() {}
    If (this ._alpha > = 0) {}
    This ._alpha-= 5;
    If (this ._alpha > = 100 | this ._alpha < = 0) {}
    for (var j: Number = 0; j < = i; j ++) {}
    {if (TL ["fireMC" + j])}
    TL ["fireMC" + j] .removeMovieClip ();
    }
    }
    }
    }}}

    Also removes fire and restores the waterBtn


    {reset_mc.onRelease = Function ()}
    waterBtn._visible = true;
    for (var j: Number = 0; j < = i; j ++) {if (tl ["fireMC" + j]) {}
    TL ["fireMC" + j] .removeMovieClip ();
    }
    }

    It works fine the first time, but after using the reset double created fire fade or remove.  I think it has something to do with the designation of the movieclips in double (12th line of code).  I would like duplicated fires to always fade no matter how many times reset you but I don't have a clue as to how to code it.  I hope this makes sense.  Any help would be appreciated. Thanks in advance.

    Try

    {reset_mc.onRelease = Function ()}

    waterBtn._visible = true;

    for (var j: Number = 0; j<>

    TL ["fireMC" + j] .removeMovieClip ();

    }

    i = 0; //<----- reset ="">

    }

  • Remove duplicates movieclips problem

    I have a shooting game where I duplicate the bullet holes in the wall.  Works fine even if I have to use the Version: Flash Player 6 to get the code to work.  The following simple code:

    {hit1.onPress = Function ()}

    i ++ ;

    _root. Bullet.duplicateMovieClip ("bulletNew", i);

    }

    I have a Reset button that I would use to remove all movieclips in double "bulletNew" at the same time.  That's what I have so far, but it removes one duplicate both:

    {reset_mc.onRelease = Function ()}

    removeMovieClip ("bulletNew");

    }

    Be clear with instructions because I've never known YOU too well.

    Thank you.

    use:

    var i: Number = 0;
    var tl:MovieClip = _root;

    Mouse.Hide ();
    startDrag (target_mc, true);

    bulletHit_mc.tabEnabled = false;
    {bulletHit_mc.onPress = function ()}
    i ++ ;
    _root. Bullet.duplicateMovieClip ("bulletNew" + i, i);
    spark_mc.gotoAndPlay (2);

    }

    reset_mc.tabEnabled = false;
    {reset_mc.onRelease = Function ()}
    for (var j: Number = 0; j<>

    {if (TL ["bulletNew" + j])}

    TL ["bulletNew" + j] .removeMovieClip ();

    }

    }

    }

    p.s. Please check the useful/correct.

  • Duplicate MovieClip moved document in rows and columns

    I need to move 130 MC in a document.
    I have width = 780 and height = 390
    There are
    * 13 mc with width = 60 horizontal
    * 10 mc with width = 39 vertical

    don't know how to fill the area with this 130 mc.

    the problem is to move the mc 1, 14, 27,... to the FLF = 0 (multiple of 13 + 1) like this

    1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13
    14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26
    27. 28. 29. ... and so on

    post on the forum or send me an email... Please!
    [email protected]

    See my response in the ActionScript group for "duplicating MovieClips in lines.
    & Columns by Husain.

    --
    Dave-
    Adobe Community Expert
    www.blurredistinction.com
    www.Macromedia.com/support/forums/team_macromedia/

  • Copy and paste multiple layers (with objects) of one movieclip to another

    Hey guys,.

    I'm really frustrated with myself because I believe that this should be easy.

    But I was stuck for centuries, hopefully you guys could help out me.

    I try to copy the images of 6 different layers and objects (action script, own movements tween, buttons, graphic elements) of one movieclip to another. But as soon as I did this, everyhting seems to have shifted and if I try to reposition elements in the new clip, it seems that I must repeat after each keyframe for each layer.

    So my question is

    Is a. possible to duplicate a clip, but give it an instance name (a completely new movieclip with the same frames and layers in the same position as the previous)?

    B. How can I move multiple objects through the layers and keyframes?

    I hope that makes sense.

    Thanks in advance for your help.

    M.

    A. you can create a movieclip instances just by dragging the movieclip on the stage and with actionscript library (if the movieclip is exported for actionscript).  all instances of movieclips created in this way will be identical.

    You can also right-click on a clip from the library and click on duplicate movieclip and then change the duplicated movieclip.  instances created of the split movieclip and original movieclip can be different.

    B. I do not understand your question.  I understand (I think) your problem.  to copy specific layers/frames, just shift-mousedown and drag through all layers and images you need.  Don't be shy on the inclusion of the layers and or framework you can remove the latter.  then paste it in a new movieclip.  remove the layers that you don't want.  If you remove all executives of other layers, you must remove the frame of all layers or you will have problems as you described.

  • Duplicate a loaded SWF, no Actionscript?

    Then... by writing a Flash based game, I have the main SWF file and its associated classes at one time, loading a single SWF file that represents a sprite in the game. I want to use this sprite repeatedly in the game, then I've duplicate after loading and expect that it would work. Unfortunately, after duplicate the loaded SWF file, it seems to be ignoring the actionscript timeline such as gotoAndPlay() calls.

    Here is the configuration:

    The loaded SWF that contains the animated sprite has a single layer on the timeline and basically has a number of labeled images dedicated to each animation - that is to say, there is a "walk_east" image, which traverses a character walking East, and at the end of this animation, has a command of gotoAndPlay ("walk_east") on one of the frames that it returns at the beginning of this particular animation to repeat the whole ordeal. The image after this one could be "walk_west" and contain West animation walk, etc. The very first frame of the SWF has a simple "stop()" call in there, so nothing no anime until the main SWF file tells the SWF loaded to do it (via a gotoAndPlay() call). This SWF has a base known as "Actor" document class

    The main SWF load this SWF using a typical loader. Then, to duplicate the loaded SWF file, I opted to do something like that, where the "clip" is a reference to the loaded SWF loader:

    var swfClass: Class = clip.contentLoaderInfo.applicationDomain.getDefinition("Actor");
    var clone = new swfClass();

    I can create any duplicates, I want, no problem. However, as soon as I start playing a (i.e., "clone.gotoAndPlay ("walk_east"), he comes will travel the entire chronology of the loaded sprite / duplicated SWF - ignoring the various actionscript code on the bases that SHOULD it be repetition of the cycle of specific animation I want... and despite the fact that when played, the same SWF does not display this behavior.")

    As well as her duplicate movieclip causes duplicated SWF to lose his actionscript on the timeline?

    Someone at - it ideas? This is expected behavior? I can't imagine this is how it should be - I want to only load the SWF sprite just once, to save bandwidth and then reproduce them as many times I want to in the game. This had to be done before... I can't imagine the developers simply reload the SWF even several times if necessary the same SWF to be used several times - that is to say, several enemies of the same type.

    Or I just do it more difficult that there must be? Help, please!

    RE: "the reason why I use the charger and not simply add the SWF file at the library of the FLA is because the sprites to load are dynamic based on a number of variables and a configuration XML file-driven." The only app knows which fund sovereigns to load at runtime based on things like what level the player entered... »

    OK, so? You shouldn't need a charger for the sprites just because they are built dynamically.
    You can keep all the config in the XML files, but keep the logic in separate classes that are all referenced in the same FLA file. You say "...". sprites to load are dynamic based on a number of variables... "OK, you can not create these sprites for parts that are in your library dynamically by using the operator"new "? Try a different approach, do not get stuck on the technical problem which is most likely a bug in the VM... If it doesn't, just leave it. Try a different approach.

  • Can not duplicate movies in a loop

    Hello

    I want to duplicate movieclips in a loop. When a clip is created, I can't access it to assign properties. I tried several ways but could not pass. The code is as follows:

    First code:

    var newMovie;
    for (i = 1; i < 5; i ++)
    {
    newMovie = "mc_answer_" + i;
    duplicateMovieClip ("original_movie", newMovie, i);
    newMovie._x = 300 + (I * 2);
    }

    Second code:

    for (i = 1; i < 5; i ++)
    {
    duplicateMovieClip ("original_movie", "mc_answer_" + I, i);
    ["mc_answer_" + i] ._x = 300 + (I * 2); gives the syntax error
    }



    I know its trivial and there is a syntax error that I do. Can anyone help?

    Thank you

    Essaeyu

    for the second method to work all you need to do is change the line of code inside the loop of
    ["mc_answer_" + i] ._x = 300 + (I * 2); gives the syntax error

    TO

    eval("mc_answer_"_+_i)._x = 300 + (I * 2);

  • How to copy dynamic MCs?

    Use as I created a dynamic movieclip with a bunch of symbols using attachMovie. But how can I make copies or duplicates of the present on the scene w / dynamic content intact?

    "duplicateMovie", I can say only include content that is dynamically... loaded or it can?

    No you can't duplicate your movieclip and clips that were attached.

    However, you can define a function that attaches the desired movieclips and which accepts a parameter as a parent. Then you can duplicate your original parent and call your function using the original and duplicate movieclips as parameters passed to the function. who looks the same as what you trying to accomplish

  • How to create duplicate or copy of movieclip?

    I have a movieclip on my scene and I need to dublicate in scene. East - liable?

    You can make several duplicates

    var newInstance:DisplayObject = duplicateDisplayObject (mcBg, true);

    var newInstance1:DisplayObject = duplicateDisplayObject (mcBg, true);

    var newInstance2:DisplayObject = duplicateDisplayObject (mcBg, true);

    and so on...

  • Move timeline, causing some movieclips to duplicate

    Something in my flash file is originally a movieclip to duplicate. I think it's down to call gotoAndPlay. I don't have a way in AS2 to check the parent children and perhaps remove the movieclip by double. Anyone encountered anything similar?

    Just to describe the problem more in detail. I have a series of pages. When you click on through a new page to that page moves on the site, but kinda sticks out, so you can bring back again. On a page, you click on a button to go to a new page. The third time I do a duplicate of the page that I'm moving away seems to appear. The double moves out of the way (with none of the initialized components) and the original rest coming to overlap the page that should be displayed. I'm not going to the keyframe where the MC is displayed so I don't know why it is to be duplicated.

    The problem was that I was setting the depth of movieclips authoring-time at a specific depth. Looks like when flash has moved to a new place on the timeline that he thought the CSM are absent and re-created. What I should have done was something like this: mc1.swapDepths (mc2)

  • cannot duplicate action or movieclips to my scroll bar

    Hello

    I have a script to scroll the content of my movieclip

    I use this tutorial:

    There are two movieclip: content_mc & mask_mc

    and here is my script:

    var rect:Rectangle;

    var scrollerMinY:Number = scrollbar_mc.scroller_mc.y;
    var contentMaxY:Number = content_mc.y;
    var padding: Number = 40;

    scrollbar_mc.scroller_mc.buttonMode = true;

    scrollbar_mc.scroller_mc.addEventListener (MouseEvent.MOUSE_DOWN, dragIt);

    function dragIt(e:MouseEvent):void {}

    Rect = new Rectangle (4, 3, 0, 309);

    scrollbar_mc.scroller_mc.StartDrag (rect, false);

    stage.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    scrollbar_mc.scroller_mc.addEventListener (Event.ENTER_FRAME, scrollIt);

    }

    function dropIt(e:MouseEvent):void {}

    scrollbar_mc.scroller_mc.stopDrag ();

    scrollbar_mc.scroller_mc. RemoveEventListener (Event.ENTER_FRAME, scrollIt);

    }

    function scrollIt(e:Event):void {}

    var scrollerRange:Number = rect.height;
    var contentRange:Number = content_mc.height - mask_mc.height + padding;
    var percent: Number = (scrollbar_mc.scroller_mc.y - scrollerMinY) / scrollerRange;
    var targetY: number = contentMaxY - percentage * contentRange;
    content_mc.y = targetY;
    }

    everything works fine...

    but now I want to use this script in another setting with an other Movieclips (content)

    I put a different instance name for my content for example film clip: newcontent_mc

    copy all actions, scrollbar movieclip and mask_mc in the same

    and I replace content_mc with newcontent_mc in my script!

    I have no error in the compiler when test but the scrollable content not more!

    I try to change the name of the instance mask_mc and scrollbar_mc and scroller_mc and edit it in the script too!

    but not success at all

    output I get this error when testing the animation:

    TypeError: Error #1010: a term is undefined and has no properties.

    at RAHAPharmOrgin_fla::ampouleproducts_49/frame1()

    What is my mistake?  What to do to use the scrollbar to my different content of movieclip in my project?

    Change your code to:

    put this on the first keyframe that contains content_mc

    var target_mc:MovieClip = content_mc;

    //

    put this on the first keyframe that contains newcontent_mc

    target_mc = newcontent_mc;

    put this on the first keyframe that contains your scroller

    var rect:Rectangle;

    var scrollerMinY:Number = scrollbar_mc.scroller_mc.y;
    var contentMaxY:Number = content_mc.y;
    var padding: Number = 40;

    scrollbar_mc.scroller_mc.buttonMode = true;

    scrollbar_mc.scroller_mc.addEventListener (MouseEvent.MOUSE_DOWN, dragIt);

    function dragIt(e:MouseEvent):void {}

    Rect = new Rectangle (4, 3, 0, 309);

    scrollbar_mc.scroller_mc.StartDrag (rect, false);

    stage.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    scrollbar_mc.scroller_mc.addEventListener (Event.ENTER_FRAME, scrollIt);

    }

    function dropIt(e:MouseEvent):void {}

    scrollbar_mc.scroller_mc.stopDrag ();

    scrollbar_mc.scroller_mc. RemoveEventListener (Event.ENTER_FRAME, scrollIt);

    }

    function scrollIt(e:Event):void {}

    var scrollerRange:Number = rect.height;
    var contentRange:Number = content_mc.height - mask_mc.height + padding;
    var percent: Number = (scrollbar_mc.scroller_mc.y - scrollerMinY) / scrollerRange;
    var targetY: number = contentMaxY - percentage * contentRange;
    target_mc.y = targetY;
    }

  • Duplicate of MovieClips made by the Flash drawing API

    Hello

    I have this simple configuration:

    -MOVIECLIP1, with more than 30 design execution forms which modify the enterframe.

    - and MOVIECLIP2, which must contain an exact copy of the comic data MOVIECLIP1.

    The point is that MOVIECLIP2 will be like a 'reflection' or 'shadow' of movieclip1.

    I will not need to make one any interaction with it, just apply filters.

    Is there anyway that this can be possible - rather than having to draw the same forms twice on the two movieclips?

    Thank you

    never done it myself but looking at the MovieCLip API

    you draw these shapes on the MC graphics object?

    Maybe mc2.graphics.copyFrom (mc1.graphics);

  • By using the same class for movieclips duplicate

    Hi all

    I created an external a particular movieclip class and I would like to bind a version duplicated this MovieClip in the same class file.

    Problem is that I can't seem to do. Even if I declare the class as a BASE of the new movieclip class and create another name of the random class for it.

    Is there a way I can get around this so I can give my clip duplicated the same class name?

    Thanks in advance

    Martin

    use:

    package {}
       
    import flash.display.MovieClip;
       
    SerializableAttribute public class Animal1 extends Animal {}
           
    public void Animal1 (): void {}
               
    Super (frameNumber, level);
               
    }
    }
    }

    you will then get errors telling you of frameNumber and level are not defined.  fix this.

  • An array of MovieClips. When I change the properties, it duplicates the item...

    Greetings,

    I will do my best to explain what is happening. I have the feeling that this has something to do with how I say things, but I'm a bit new with AS3 so please have patience.

    On my stage, I have a movie clip (mContainer). In the library, I have an another movieclip (mElement), which has been exported for actionScript as mElement.

    The first image, I have the following code:

    import flash.events.*;
    
    var mElem:Array = new Array();
    
    stage.addEventListener(Event.ENTER_FRAME, onEnterFrameEvt);
    stage.addEventListener(MouseEvent.CLICK, onMouseClickEvt);
    
    function onEnterFrameEvt(event:Event):void {
      for (var i:uint=0;i<10;i++) {        
           mElem[i] = new mElement();
           mElem[i].x = 15*i;
           mContainer.addChild(barArray[i]);              
      }           
       mElem[2].x = 300; // (1) For testing purposes only...
    }
    function onMouseClickEvt(event:MouseEvent):void {
         mElem[2].x = 400; // (2) For testing purposes only...
    }
    
    this.stop();
    

    When the script reaches (1), she correctly moves the movieClip to new x. However, when I click on the scene, and the event is generated, (2) creates a copy of the object on the stage... so, I find myself with a single object at x = 300 and the other at x = 400 when what I actually wanted was to move the object from one place to the other.

    Could enlighten me is it someone please on why it doesn't work as I hope?

    Thank you very much!

    What is happening is that your enterframe event is continually running and re-create these 10 objects at a fast enough pace.  You can see if you are implementing a value of investment there as well and that increment for each execution of the loop for.  If you use removeEventListener to the enterframe event after completing the first execution of the function that adds all the songs, your pieces should behave as expected (I think... "I guess I understand the problem).

    If the intention is not to continuous fire that work, you should remove the enterframe listener entirely and just retrieves the code for the function and runs it just a moment.

Maybe you are looking for

  • If I restore firefox until a certain date I lose bookmarks in my other brosers

    My story has been deleted whenever I closed Firefox. I didn't know that. Now I need my story, for the last 10 days. Options of Firefox that I can restore my favorites until a certain date but will be replaced by the new story. Is it only in Firefox o

  • HP Premium - why 'Properties of the wireless network' did not appear in the settings!

    Hi, I have updated the firmware on my HP Calculator first, and since then "wireless network properties" have disappeared from the settings. Basically, there are four pages of settings and now there are only three! On the other hand, the emulator yet

  • satellite P30-109 with atheros AR5004G will hang the PC

    I have a P30, and when I'm on the internet of card wireless wil hang itself together with pc.When you restart the pc, it gives an erros:"conflict with pci slot 3 (pci bus 2, device 2, function 0).the only thing that helps is to screw open the pc remo

  • Problem with scanning from the new laptop with Windows 8

    I have a Photosmart C4480 all-in-One printer/scanner/copier.  Since getting my new laptop, I have problems with the analysis feature.  I installed the software CD, and think I have downloaded the drivers for this printer. Indicates the serial number

  • probook450G2: biometric lock

    I've been good a new probook450G2. I can not activate to activate the fingerprint lock. I already intall validity fingerprint sensor driver.but I can't lock. What is action for that fingerprinting lock.advance thnx...