A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: duplicate movieClip i times

  1. #1
    Junior Member
    Join Date
    Nov 2006
    Posts
    17

    duplicate movieClip i times

    Hi foreros
    For most of you this is as easy as ABC, but not for me.
    The thing is I need to duplicate my movieclip 10 times, and I don't know where or how to add the for sentence.
    The code is the following:
    Code:
    var timeline: MovieClip = this;
    var counter: Number = 0;
    
    timeline.inicial.onRelease = function( )
    {
    	
    	var newClip: MovieClip = this.duplicateMovieClip("copia" + timeline.counter, timeline.getNextHighestDepth() );
    	timeline.counter++;
    	newClip._rotation = inicial._rotation+180;
        newClip._x = 90 + timeline.counter*40;
    	newClip._y = 110 + timeline.counter;	//lo giro y  lo posiciono
    	
    }
    Thank you in advance.

  2. #2
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    Code:
    var timeline:MovieClip = this;
    
    timeline.inicial.onRelease = function() {
    	for (var i:Number = 0; i<10; i++) {
    		var newClip:MovieClip = this.duplicateMovieClip("copia"+i, timeline.getNextHighestDepth());
    		newClip._rotation = inicial._rotation+180;
    		newClip._x = 90+(i*40);
    		newClip._y = 110+i;//lo giro y  lo posiciono
    	}
    };
    moo

  3. #3
    Junior Member
    Join Date
    Nov 2006
    Posts
    17
    Thank you, caroach.

  4. #4
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    no problem
    moo

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