A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: arrays? i think

  1. #1
    shavingcream incarnate gukinator's Avatar
    Join Date
    Jul 2008
    Location
    Santa Cruz
    Posts
    147

    arrays? i think

    PHP Code:
    160;
    dupMovie = function () {
        for (
    i=1i<10i++) {
            
    piece.duplicateMovieClip("circle"+ii,{
                
    _x:X*i
                
    _y:550
            
    });
        }
    };
    dupMovie();
    button_left.onPress = function(){ 
    i have this code in which circles, with a width of 160 and the rotation point set to the upper right hand corner,
    line up side by side starting from the left edge of the screen and i want to be able to move all of the "circles" at once
    i also wish to make the code flexible so if i change the number of circles i want to make, those will also be moved
    haha and fyi this isnt my 1st post, i jsut lost my password and dont use that e-mail any more
    Last edited by gukinator; 07-17-2008 at 12:15 PM.

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518

    Maybe you can adapt this to what you are trying to do...

    Code:
    X = 160;
    moveAmt = 5;
    piecesArray = new Array();
    dupMovie = function () {
    	for (i = 1; i < 10; i++) {
    		piecesArray.push(piece.duplicateMovieClip("circle" + i, i, {_x:X * i, _y:150}));
    	}
    };
    dupMovie();
    button_left.onPress = function() {
    	this.onEnterFrame = function() {
    		for (i in piecesArray) {
    			piecesArray[i]._x -= moveAmt;
    		}
    	};
    };
    button_left.onRelease = function() {
    	delete this.onEnterFrame;
    };
    button_left.onReleaseOutside = button_left.onRelease;

  3. #3
    shavingcream incarnate gukinator's Avatar
    Join Date
    Jul 2008
    Location
    Santa Cruz
    Posts
    147
    thanks a lot
    that works great, im sure ill be able to work with this

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