To find the x, y positions on the stage using flash actionscript

var Width = 150;
var YWidth = 100;
var n = 0;
CenterY = 0;
this.createEmptyMovieClip('holder', 1);
holder.lineStyle(1, 0xFFFFFF);
holder._x = 300;
holder._y = 200;
this.onEnterFrame = function() {
	if (n == 0) {
		holder.moveTo(Math.cos(n)*Width, Math.sin(n)*YWidth);
		holder.lineTo(Math.cos(n)*Width, Math.sin(n)*YWidth);
	}
	holder.lineTo(Math.cos(n)*Width, this.CenterY+(Math.sin(n)*YWidth));
	holder.TotalCircle = 6.3;
	if (n<holder.TotalCircle/1) {
		n += .1;
	} else {
		delete this.onEnterFrame;
		holder.onEnterFrame = abc;
	}
};
holder.onMouseMove = function() {
	_root.dataNumber = (this._xmouse+' : '+this._ymouse);

	_root.interSectionPOint._x = this._x+this._xmouse;
	_root.interSectionPOint._y = this._y+this._ymouse;
	if (this._xmouse<0 && this._ymouse<0) {
		this.startPoint = (this.TotalCircle/4)*2;
		this.endPoint = (this.TotalCircle/4)*3;
	} else if (this._xmouse>0 && this._ymouse<0) {
		this.startPoint = (this.TotalCircle/4)*4;
		this.endPoint = (this.TotalCircle/4)*3;
	} else if (this._xmouse<0 && this._ymouse>0) {
		this.startPoint = (this.TotalCircle/4)*1;
		this.endPoint = (this.TotalCircle/4)*2;
	} else if (this._xmouse>0 && this._ymouse>0) {
		this.startPoint = (this.TotalCircle/4)*0;
		this.endPoint = (this.TotalCircle/4)*1;
	}
};
abc = function () {
	if (this.startPoint<this.endPoint) {
		this.startPoint += .1;
		var n_x = Math.cos(this.startPoint)*Width;
		var n_y = Math.sin(this.startPoint)*YWidth;
		var diff = n_y-this._ymouse;
		if (diff<1 && diff>-1) {
			_root.interSectionPOint._x = this._x+n_x;
			_root.interSectionPOint._y = this._y+n_y;
		}
	}
};

This movie requires Flash Player 9

Tags: ,

One Response to “To find the x, y positions on the stage using flash actionscript on “To find the x, y positions on the stage using flash actionscript”

Hi, Stranger! Leave Your Comment...

Name (required)
Email (required)
Website