Ver Mensaje Individual
  #7 (permalink)  
Antiguo 27/03/2008, 04:51
werkham
 
Fecha de Ingreso: abril-2005
Ubicación: Melilla
Mensajes: 120
Antigüedad: 19 años
Puntos: 1
Re: Ayuda con menu acordeon

Código:
stop();
var _on:Boolean = false;
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
	_on = true;
}
var mouseListener2:Object = new Object();
mouseListener2.onMouseDown = function() {
	_on = false;
}
speed = 10;
initial_width = 75;
target_width = 450;
sp = rect1._x;
this.createEmptyMovieClip("emptymc", 0);
emptymc.onEnterFrame = function() {	
for (i=1; i<=6; i++) {
	if (_root.hit.hitTest(_root._xmouse, _root._ymouse, true)) {
		Mouse.addListener(mouseListener);
		if (_root["rect"+i].hitTest(_root._xmouse, _root._ymouse, true) && _on) {
			new_x = (_root.sp-(75*(i-1)))-rect1._x;
			rect1._x += new_x/speed;
			n_width = target_width-_root["rect"+i]._width;
			_root["rect"+i]._width += n_width/speed;
		} else {
			n_width2 = initial_width-_root["rect"+i]._width;
			_root["rect"+i]._width += n_width2/speed;
		}
	} else {
                Mouse.addListener(mouseListener2);
		if(_root["rect"+i].hitTest(_root._xmouse, _root._ymouse, true) && !_on){
		new_x = _root.sp-rect1._x;
		rect1._x += new_x/(speed+50);
		n_width2 = initial_width-_root["rect"+i]._width;
		_root["rect"+i]._width += n_width2/(speed-1);
               }
               Mouse.removeListener(mouseListener);
               Mouse.removeListener(mouseListener2);
	}
	_root["rect"+(i+1)]._x = _root["rect"+i]._x+_root["rect"+i]._width;
	_root["movie"+i]._x = _root["rect"+i]._x-1;
	}
};
eso es lo que he hecho, he añadido otro listener que pone _on a false xo no se porque no funciona
__________________
No soy vago, solo soy tímido ante el esfuerzo...