fibonacci actionscript code (gruntwork frame)

//change fibonacci sequence variables
lastlast_radius_r = last_radius_r;
last_radius_r = radius_r;
radius_r = lastlast_radius_r+last_radius_r;
//draw the square for this itteration
if (radius_r<110000) {
	if (next_direction == "right") {
		//set this starting point as the one defined last "up" time
		radius_x = nextRight_radius_x;
		radius_y = nextRight_radius_y;
		//draw and fill the square
		with (this.spiral) {
			lineStyle(0, 0x000000, 100);
			beginFill(0xCCCCFF);
			moveTo(radius_x, radius_y);
			lineTo(radius_x+radius_r, radius_y);
			lineTo(radius_x+radius_r, radius_y+radius_r);
			lineTo(radius_x, radius_y+radius_r);
			lineTo(radius_x, radius_y);
			endFill();
		}
		//draw spiral
		with (this.spiral) {
			lineStyle(0, 0x000000, 100);
			moveTo(radius_x, radius_y+radius_r);
			curveTo(radius_x+radius_r, radius_y+radius_r, radius_x+radius_r, radius_y);
			moveTo(radius_x, radius_y);
		}
		//set the next down starting point
		nextDown_radius_x = radius_x+radius_r;
		nextDown_radius_y = radius_y+radius_r;
		//scale and move
		spiral_right_width = spiral_right_width+radius_r;
		with (this.spiral) {
			_xscale = 500/Number(spiral_left_width+spiral_right_width)*100;
			_yscale = _xscale;
			_x = Number(500-Number(_xscale*Number(spiral_left_width+spiral_right_width)/100))/2+_xscale*spiral_left_width/100;
			_y = Number(500-Number(_yscale*Number(spiral_up_height+spiral_down_height)/100))/2+_yscale*spiral_up_height/100;
		}
		//set the next iteration's direction
		next_direction = "up";
	} else if (next_direction == "up") {
		radius_x = nextUp_radius_x;
		radius_y = nextUp_radius_y;
		with (this.spiral) {
			lineStyle(0, 0x000000, 100);
			beginFill(0xFFCCFF);
			moveTo(radius_x, radius_y);
			lineTo(radius_x+radius_r, radius_y);
			lineTo(radius_x+radius_r, radius_y-radius_r);
			lineTo(radius_x, radius_y-radius_r);
			lineTo(radius_x, radius_y);
			endFill();
		}
		with (this.spiral) {
			lineStyle(0, 0x000000, 100);
			moveTo(radius_x+radius_r, radius_y);
			curveTo(radius_x+radius_r, radius_y-radius_r, radius_x, radius_y-radius_r);
			moveTo(radius_x, radius_y);
		}
		nextRight_radius_x = radius_x+radius_r;
		nextRight_radius_y = radius_y-radius_r;
		//scale and move
		spiral_up_height = spiral_up_height+radius_r;
		with (this.spiral) {
			_yscale = 500/Number(spiral_up_height+spiral_down_height)*100;
			_xscale = _yscale;
			_x = Number(500-Number(_xscale*Number(spiral_left_width+spiral_right_width)/100))/2+_xscale*spiral_left_width/100;
			_y = Number(500-Number(_yscale*Number(spiral_up_height+spiral_down_height)/100))/2+_yscale*spiral_up_height/100;
		}
		next_direction = "left";
	} else if (next_direction == "left") {
		radius_x = nextLeft_radius_x;
		radius_y = nextLeft_radius_y;
		with (this.spiral) {
			lineStyle(0, 0x000000, 100);
			beginFill(0xFFCCCC);
			moveTo(radius_x, radius_y);
			lineTo(radius_x-radius_r, radius_y);
			lineTo(radius_x-radius_r, radius_y-radius_r);
			lineTo(radius_x, radius_y-radius_r);
			lineTo(radius_x, radius_y);
			endFill();
		}
		with (this.spiral) {
			lineStyle(0, 0x000000, 100);
			moveTo(radius_x, radius_y-radius_r);
			curveTo(radius_x-radius_r, radius_y-radius_r, radius_x-radius_r, radius_y);
			moveTo(radius_x, radius_y);
		}
		nextUp_radius_x = radius_x-radius_r;
		nextUp_radius_y = radius_y-radius_r;
		//scale and move
		spiral_left_width = spiral_left_width+radius_r;
		with (this.spiral) {
			_xscale = 500/Number(spiral_left_width+spiral_right_width)*100;
			_yscale = _xscale;
			_x = Number(500-Number(_xscale*Number(spiral_left_width+spiral_right_width)/100))/2+_xscale*spiral_left_width/100;
			_y = Number(500-Number(_yscale*Number(spiral_up_height+spiral_down_height)/100))/2+_yscale*spiral_up_height/100;
		}
		next_direction = "down";
	} else if (next_direction == "down") {
		radius_x = nextDown_radius_x;
		radius_y = nextDown_radius_y;
		with (this.spiral) {
			lineStyle(0, 0x000000, 100);
			beginFill(0xCCFFCC);
			moveTo(radius_x, radius_y);
			lineTo(radius_x-radius_r, radius_y);
			lineTo(radius_x-radius_r, radius_y+radius_r);
			lineTo(radius_x, radius_y+radius_r);
			lineTo(radius_x, radius_y);
			endFill();
		}
		with (this.spiral) {
			lineStyle(0, 0x000000, 100);
			moveTo(radius_x-radius_r, radius_y);
			curveTo(radius_x-radius_r, radius_y+radius_r, radius_x, radius_y+radius_r);
			moveTo(radius_x, radius_y);
		}
		nextLeft_radius_x = radius_x-radius_r;
		nextLeft_radius_y = radius_y+radius_r;
		//scale and move
		spiral_down_height = spiral_down_height+radius_r;
		with (this.spiral) {
			_yscale = 500/Number(spiral_up_height+spiral_down_height)*100;
			_xscale = _yscale;
			_x = Number(500-Number(_xscale*Number(spiral_left_width+spiral_right_width)/100))/2+_xscale*spiral_left_width/100;
			_y = Number(500-Number(_yscale*Number(spiral_up_height+spiral_down_height)/100))/2+_yscale*spiral_up_height/100;
		}
		next_direction = "right";
	}
	//end scripts
	trace(radius_r);
	nextFrame();
} else {
	//end scripts
	trace(radius_r);
	gotoAndPlay(1);
}