Foros del Web » Creando para Internet » Flash y Actionscript »

AS 2 - Puntos, Cordenadas

Estas en el tema de AS 2 - Puntos, Cordenadas en el foro de Flash y Actionscript en Foros del Web. Hola a todos.. Buenas tardes.. Básicamente mi problema es este: Tengo que hacer algo excamente igual a esto: http://concurso.cnice.mec.es/cnice20...web/trian8.htm El primero del lado derecho, el ...
  #1 (permalink)  
Antiguo 16/04/2010, 19:12
Avatar de Nachzeher  
Fecha de Ingreso: enero-2003
Mensajes: 249
Antigüedad: 21 años, 3 meses
Puntos: 1
AS 2 - Puntos, Cordenadas

Hola a todos.. Buenas tardes..

Básicamente mi problema es este:

Tengo que hacer algo excamente igual a esto:
http://concurso.cnice.mec.es/cnice20...web/trian8.htm

El primero del lado derecho, el del círculo. Pero en Flash con AS 2

Esto es lo que tengo hecho, Video:
http://www.youtube.com/watch?v=okEYQtJLME0


Lo que no he podido hacer es el cuadrito pequeño que marca el ángulo de 90 Grados.
Me sugirieron en un conocido foro, que usara la Clase "Point" para calcular unos
puntos interpolados en lo que podría ser un 20% de las lineas y con "Polar"
determinar un punto cartesiano entre ambos para trazar ese cuadrito..

Sin embargo, cuando intento hacerlo los puntos sencillamente no "son nada".

Este es el código:

Código:
//Big circle's x y cordinates, center registration
centerX = theCircle._x;
centerY = theCircle._y;
//radius for the circle
radius = theCircle._width/2;

//Dibujar 3 Líneas
ReDibujarTriangulo();


//drag the slider
slider.onPress = function() {
	slider.onMouseMove = dragTime;
};
//stop dragging
slider.onRelease = function() {
	slider.onMouseMove = null;
};
//stop.dragging
slider.onReleaseOutside = function() {
	slider.onMouseMove = null;
};


//function to drag the slider
function dragTime() {
	//Find out the angle between the eyeball's center and the point where mouse is at
	var radians = Math.atan2(_root._ymouse-theCircle._y, _root._xmouse-theCircle._x);
	//radius for the circle
	radius = theCircle._width/2;
	//find out the x y coordinates of this object, from the calculated angle
	//multiplying the cos and sin of the angle,by the radius ensures---->
	//that the object will be placed on the circumference of the big circle
	this._y = theCircle._y+Math.sin(radians)*radius;
	this._x = theCircle._x+Math.cos(radians)*radius;
	
	updateAfterEvent();
	ReDibujarTriangulo(); //Robertool
}

function ReDibujarTriangulo(){
	DibujarTriangulo();
	
	this.Noventa._x = slider._x - 15;
	this.Noventa._y = slider._y + 20;
}

function DibujarTriangulo(){
	this.createEmptyMovieClip("Diametro", 5);
	this.Diametro.lineStyle(1, 0x0000FF, 100);
	this.Diametro.moveTo(PuntoB._x + 5, PuntoB._y + 5);
	this.Diametro.lineTo(PuntoA._x + 5, PuntoA._y + 5);
	
	this.createEmptyMovieClip("LineaBC", 10);
	this.Diametro.lineStyle(1, 0x0000FF, 100);
	this.Diametro.moveTo(PuntoB._x + 5, PuntoB._y + 5);
	this.Diametro.lineTo(slider._x, slider._y);
	
	this.createEmptyMovieClip("LineaCA", 15);
	this.Diametro.lineStyle(1, 0x0000FF, 100);
	this.Diametro.moveTo(slider._x, slider._y);
	this.Diametro.lineTo(PuntoA._x + 5, PuntoB._y + 5);	
	
	//Puntos para la marca de 90 Grados
	var pbx:Number = PuntoB._x + 5;
	var pby:Number = PuntoB._y + 5;
	var pax:Number = PuntoA._x + 5;
	var pay:Number = PuntoA._y + 5;
	var psx:Number = slider._x;
	var psy:Number = slider._y;
	
	Ptb:Point = new Point(pbx, pby);
	Pts:Point = new Point(psx, psy);
	Ppa:Point = new Point(pax, pay);
	
	Ppb:Point = Point.interpolate(Ptb, Pts, 0.2);
	Ppa:Point = Point.interpolate(Ppa, Pts, 0.2);
	
	this.createEmptyMovieClip("raya", 20);
	this.Diametro.lineStyle(3, 0x0000FF, 100);
	this.Diametro.moveTo(Ppb.x, Ppb.y);
	this.Diametro.lineTo(Ppa.x, Ppa.y + 50);
}


Tienen alguna idea, al respecto de como podria hacerlo?

Gracias de antemano..
  #2 (permalink)  
Antiguo 18/04/2010, 09:55
Avatar de Nachzeher  
Fecha de Ingreso: enero-2003
Mensajes: 249
Antigüedad: 21 años, 3 meses
Puntos: 1
Respuesta: AS 2 - Puntos, Cordenadas

Alguna idea?

Etiquetas: puntos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:31.