A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] DuplicateMovieClip while createEmptyMovieClip?

  1. #1
    Junior Member
    Join Date
    Jul 2007

    [F8] DuplicateMovieClip while createEmptyMovieClip?


    i am creating an empty MC with the following code..

    this.createEmptyMovieClip("main_mc",getNextHighest Depth());
    main_mc.createEmptyMovieClip("layout_mc",getNextHi ghestDepth());
    main_mc.layout_mc._x = 200;
    main_mc.layout_mc._y = 200;

    Then i would like to duplicate the beam.swf file with a duplicatiemovie script..

    wich is this one..

    onClipEvent (enterFrame) {
    // initialize variable at 0
    i = 0;
    do {
    // make copies of the movie clip
    duplicateMovieClip (_root.main_mc.layout_mc, "layout_mc" + i, i);

    // rotate the copies i degrees
    setProperty (eval("_root.main_mc.layout_mc" + i), _rotation, i);
    // increment the counter by 15
    i = i+15;
    // check the condition
    } while (i<1439);
    // make the original movie clip invisible
    main_mc.layout_mc._visible = 0;

    The both scripts work seperate.
    But mixing them doesn't seem to work.
    Does anyone know how to combine these two scripts?

    Or does duplicateMovieClip just duplicate the empty clip, without its contents?
    Last edited by raoul petrus; 07-30-2007 at 07:26 PM. Reason: forgot my version

  2. #2
    Join Date
    Jul 2007
    It sounds like the 'onEnterFrame()' script is firing before the beam.swf has had a chance to load. You can set up a listener to wait for the your swf to load. Cleaned up the duplicate loop code a little too.

    //create a listener for the clip loader
    var loadListener:Object = new Object();
    //set the event responses
    loadListener.onLoadComplete = function() {
    	trace("beam.swf loaded");
    loadListener.onLoadInit = function() {
    //create a movieclip loader and attach a listener
    var mcLoader:MovieClipLoader = new MovieClipLoader(loadListener);
    //load beam.swf
    //duplicate clip
    function duplicateBeam() {
    	for (i=0; i<96; i++) {
    		duplicateMovieClip(_root.main_mc.layout_mc, "layout_mc"+i, _root.main_mc.getNextHighestDepth());
    		_root.main_mc["layout_mc"+i]._rotation = i*15
    	_root.main_mc.layout_mc._visible = false;
    If at first you don't succeed... Try not to look suprised.

  3. #3
    Junior Member
    Join Date
    Jul 2007


    Thanx, this helps me on the way..
    The empty movieclip is created, so is the main_mc and the layout_mc
    it is loading the swf, but not duplicating the main_mc with content.

    Some more visual info would perhaps clear the matter:

    beam.swf is the base, looking like this:

    This i have set to rotate and duplicate, creating the following patern:

    loading the first image works fine..
    But with duplicating the main_mc, the duplicated mc doesnt seem to take the content, and is just diplaying the originaly loaded beam.swf.

    or main_mc is not duplicated..?

    I am working still with FLASH 8 & AS2 mayby thats the problem?

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