Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/06/2003, 22:38
Avatar de GhostRider
GhostRider
 
Fecha de Ingreso: julio-2001
Ubicación: en mi propio infierno
Mensajes: 248
Antigüedad: 22 años, 9 meses
Puntos: 0
Pues no sale


a ver, aqui va de nuevo: tengo un simbolo "dot" que tiene este Action Script dentro del primer frame de la MP:

Código:
dragging = false;
onEnterFrame = function () {
	dx = 0;
	dy = 0;
	// sumerise the delta for all dots that are connected to this dot
	for (i=0; i<connected.length; i++) {
		dx += _root["dot"+connected[i]]._x-delta_x[i]-_x;
		dy += _root["dot"+connected[i]]._y-delta_y[i]-_y;
	}
	// if the current point is not dragged
	if (!dragging) {
		// if delta is very small negate it
		if (math.abs(dx)<1) {
			dx = 0;
		}
		if (math.abs(dy)<1) {
			dy = 0;
		}
		// vectors vx,vy are calculated in "elastic way"
		vx = vx*.84+dx*.14;
		vy = vy*.84+dy*.14;
		_x += vx;
		_y += vy;
		// bounce off the sides if needed
		if (_x>550 || _x<0) {
			vx = -vx;
			_x += vx;
		}
		if (_y>400 || _y<0) {
			vy = -vy;
			_y += vy;
		}
	}
};
onPress = function () {
	this.startDrag(false,0,0,550,400);
	this.dragging = true;
};
onRelease = function () {
	this.stopDrag();
	this.dragging = false;
	this.vx = 0;
	this.vy = 0;
};
y luego en el primer frame de scene1, entre muchas otras cosas, tengo esto:

Código:
if (newdot) {
		dots++;
		dotx[dots] = x;
		doty[dots] = y;
		duplicateMovieClip(dot, "dot"+dots, dots);
		_root["dot"+dots]._x = x;
		_root["dot"+dots]._y = y;
		_root["dot"+dots].connected = new array();
		_root["dot"+dots].delta_x = new array();
		_root["dot"+dots].delta_y = new array();
		
		if (dots == 2) {
			
			delete this["dot"+dots].onEnterFrame;
			
		
			this["dot"+dots].onLoad = function () {
				// declare and set initial variables and properties
				speed = 1;
			}

			this["dot"+dots].onEnterFrame = function() {
				gotoSpotX = _root._xmouse;
				gotoSpotY = _root._ymouse;
				dif_x = _x-gotoSpotX;
				dif_y = _y-gotoSpotY;
				targetRotation = -Math.atan2(dif_x, dif_y)/(Math.PI/180);
				_rotation = targetRotation;

				// move beetle toward the target and stop when it gets there
				if (Math.sqrt((dif_x*dif_x)+(dif_y*dif_y))>speed) {
					_y -= speed*Math.cos(_rotation*(Math.PI/180));
					_x += speed*Math.sin(_rotation*(Math.PI/180));
				}
	
			}
		}
		
       }

La parte que esta dentro de

if (dots == 2) {
}


es la que añadí segun su consejo, es decir, lo que quiero es que en vez de seguir el mouse con dragging, lo siga con el código, pero solo un punto de los que se crean.