Public feed #531155

Someone

public text v1 · immutable
Raw Edit
·published 2007-06-02 11:49 UTC
rendered paste body
var panleft = 0;
var panright = 0;
var pantop = 0;
var panbottom = 0;

var zoomin = 0;
var zoomout = 0;

/*
bg_mc._x = -70;
bg_mc._y = 128;

bg_mc._xscale = 58;
bg_mc._yscale = 58;
*/

MovieClip.prototype.DrawCircle = function (x, y){
//function circleTo(x, y, name){
	//trace("drawcircle");
	//var movie = this.createEmptyMovieClip(name, 0);
	with(this){
		var a = 20;
		var b = 20;
	
		var j = a * 0.70711;
		var n = b * 0.70711;
		var i = j - (b - n) * a/b;
		var m = n - (a - j) * b/a;
	
		//var x = Stage.width/2;
		//var y = Stage.width/2;
		beginFill(0xFF0000);
		//lineStyle(1, 0, 100);
		moveTo(x + a, y);
		curveTo(x + a, y - m, x + j, y - n);
		curveTo(x + i, y - b, x, y - b);
		curveTo(x - i, y - b, x - j, y - n);
		curveTo(x - a, y - m, x - a, y);
	
		curveTo(x - a, y + m, x - j, y + n);
		curveTo(x - i, y + b, x, y + b);
		curveTo(x + i, y + b, x + j, y + n);
		curveTo(x + a, y + m, x + a, y);
	}
}


/*
MovieClip.prototype.DrawCircle = function (x, y, r){
	//trace("this: " + this);
	var c1 = r * (Math.SQRT2 - 1);
	var c2 = r + Math.SQRT2/2;
	//trace(c1 + " : " + c2);
	lineStyle(1, 0, 100);
	this.moveTo(x + r, y);
	this.curveTo(x + r, y + c1, x + c2, y + c2);
	this.curveTo(x + c1, y + r, x, y + r);
	this.curveTo(x - c1, y + r, x - c2, y + c2);
	this.curveTo(x - r, y + c1, x - r, y);
	//this.curveTo(x - r , y - c1, x - c2, y - c2);
	//this.curveTo(x - c1, y - r, x, y - r);
	//this.curveTo(x + c1, y - r, x + c2, y - c2);
	//this.curveTo(x + r, y - c1, x + r, y);
}
*/
	
//_root.createEmptyMovieClip("circle", 1);
//_root.circle.circleTo(200, 200, 10);
//circleTo(Stage.width/2, Stage.width/2);
//circleTo(200, 200, "circle1");
//circleTo(400, 400, "circle2");


bg_mc.createEmptyMovieClip('circle', 0);

bg_mc.circle.DrawCircle(300, 300, 50);
//circle.DrawCircle(0, 70, 50);
//circle._x = 300;
//trace ("width: " + circle._width + " : " + circle._height);
//trace("_x: " + circle._x + " : " + circle._y);
var bounds_obj:Object = bg_mc.circle.getBounds(this);
for(var i in bounds_obj){
	trace(i+" --> " + bounds_obj[i]);
}
//_root.DrawCircle(500, 500, 50);
//circle.DrawCircle(200, 200, 50);


circle.onPress = function(){
	this.startDrag();
}

circle.onRelease = function(){
	this.stopDrag();
}



_root.onEnterFrame = function(){
	q = new Object();
	q.x = Math.round(_xmouse);
	q.y = Math.round(_ymouse);
	//trace(q.x + " : " + q.y);
	//trace(this.circle._x);
	p = new Object();
	p.x = bg_mc.circle._x;
	p.y = bg_mc.circle._y;
	//trace("this: " + this);
	//this.localToGlobal(p);
	trace(q.x + " : " + q.y + "////" + p.x + " : " + p.y);
	if(panright){
		bg_mc._x -= 10;
	}
	
	if(panleft){
		bg_mc._x += 10;
	}
	
	if(pantop){
		bg_mc._y += 10;
	}
	
	if(panbottom){
		bg_mc._y -= 10;
	}
	
	if(zoomin){
		bg_mc._xscale += 1;
		bg_mc._yscale += 1;
	}
	
	if(zoomout){
		bg_mc._xscale -= 1;
		bg_mc._yscale -= 1;
	}
	
}