A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Changing Flash 6 codes to Flash 8 AS2

  1. #1
    Member
    Join Date
    Oct 2006
    Posts
    48

    Changing Flash 6 codes to Flash 8 AS2

    Hello I found this code to make images bounce but it only works when I set the settings to Flash 6. Can anyone tell me how to convert the code to work for Flash 8 AS2?

    Would appreciate it if anyone could tell me how the code works
    here's the code

    Code:
    _quality = "LOW";
    
    MovieClip.prototype.dragGoback = function(startX, startY, tempo, wobble) {
    	this.onEnterFrame = function() {
    		if (!dragging) {
    			dx = (dx+(startX-this._x)*tempo)*wobble;
    			dy = (dy+(startY-this._y)*tempo)*wobble;
    			this._x = this._x+dx;
    			this._y = this._y+dy;
    		}
    		// end if   
    		for (i=1; i<=_root.cutout; i++) {
    			_root["m"+i]._x = startX-(startX-this._x)/_root.cutout*i;
    			_root["m"+i]._y = startY-(startY-this._y)/_root.cutout*i;
    		}// end of for
    	};
    };
    
    dragMe.onMouseDown = function() {
    	dragging = true;
    	this.startDrag(true);
    };
    
    dragMe.onMouseUp = function() {
    	dragging = false;
    	stopDrag();
    };
    
    dragMe.dragGoBack(dragMe._x,dragMe._y,1.000000E-01,9.900000E-01);
    
    cutout = 30;
    
    for (i=0; i<=cutout; i++) {
    	dragMe.duplicateMovieClip("m"+(cutout-i),cutout-i);
    	_root["m"+(cutout-i)].dynamask._xscale = 100+i*5;
    	_root["m"+(cutout-i)].dynamask._yscale = 100+i*5;
    }// end of for
    
    frame.swapDepths(cutout+1);
    I don't know anything about this code "MovieClip.prototype." I know a little bit that the "for" codes are for looping/repeating things. And what are the numbers "1.000000E-01,9.900000E-01"?

    I've attached the CS4 .fla here
    Attached Files Attached Files

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    it will work for Flash8 AS2 with one addition and one change

    add initial dx and dy values -
    _quality = "LOW";
    dx = dy = 0;

    and change the capitalisation in the function name -
    at present there is -
    dragGoback = function
    and -
    dragMe.dragGoBack

  3. #3
    Member
    Join Date
    Jun 2004
    Posts
    83
    You should set an initial value at the same spot:
    dragging = false;

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