Comunidad de diseño web y desarrollo en internet online

Scroll con mousewheel de penHolder

Citar            
MensajeEscrito el 22 Oct 2008 11:32 pm
buenas ^^

Estuve trabajando con el scroll + mousewheel de penHolder :

Código :

import mx.transitions.Tween; 
import mx.transitions.easing.*; 
//------------------------------------------------------------------------------- 
var posy:Number = 5; 
var left:Number = dragger._x; 
var top:Number = 0; 
var right:Number = dragger._x; 
var bottom:Number = mascara._height-dragger._height; 
var scrolled:Number; 
var friction:Number = 1.5; 
var fade:Tween; 
var movin:Tween; 
var wheel:Object = new Object(); 
// 
dragger.onPress = function() { 
   // 
   startDrag(this, false, left, top, right, bottom); 
}; 
dragger.onRelease = function() { 
   // 
   stopDrag(); 
}; 
dragger.onRollOver = function() { 
   // 
   this.useHandCursor = false; 
   fade = new Tween(this, "_alpha", Strong.easeOut, 100, 50, 1, true); 
}; 
dragger.onRollOut = function() { 
   // 
   fade.yoyo(); 
}; 
dragger.onReleaseOutside = function() { 
   // 
   this.onRollOut(); 
   this.onRelease(); 
}; 
// 
txt.setMask(mascara); 
// 
function movement():Void { 
   // 
   txt.onEnterFrame = function() { 
      // 
      scrolled = (this._height-(mascara._height/1.3))/(mascara._height-dragger._height); 
      posy = -dragger._y*scrolled; 
      // 
      movin = new Tween(this, "_y", Strong.easeOut, this._y, posy, friction, true); 
   }; 
} 
movement(); 
// 
wheel.onMouseWheel = function(incressment):Void  { 
   // 
   dragger._y -= incressment*6; 
   if (dragger._y>bottom) { 
      dragger._y = bottom; 
   } 
   if (dragger._y<top) { 
      dragger._y = top; 
   } 
}; 
Mouse.addListener(wheel); 


funcionaba bien pero al ponerle unos tweens antes y preload el contenido (txt) se mueve con demaciada lentitud, aunque el scroll (dragger) sigue funcionando correctamente.

Alguna solucion? :oops:

chiaoo (y)

Por Imer

38 de clabLevel



 

Cd. Obregón Sonora

firefox
Citar            
MensajeEscrito el 23 Oct 2008 12:01 am
es porq no se detiene el EnterFrame, prueba modificando la funcion movement:

Código ActionScript :

function movement():Void { 
   // 
   txt.onEnterFrame = function() { 
      // 
      scrolled = (this._height-(mascara._height/1.3))/(mascara._height-dragger._height); 
      posy = -dragger._y*scrolled; 
      // 
      movin = new Tween(this, "_y", Strong.easeOut, this._y, posy, friction, true); 
   }; 
   if (posy == Math.round(txt._y)) {
         delete txt.onEnterFrame
      }
} 

Por penHolder

Claber

4661 de clabLevel

39 tutoriales
2 articulos

Genero:Masculino   Premio_Secretos

| mdz |

firefox
Citar            
MensajeEscrito el 23 Oct 2008 12:03 am
Bueno ahi va otro dato curioso: cuando lo corro (ctrl + enter) no funciona el scroll, tal como les explique arriba, sin embargo, si corro el preload (ctrl + enter otra vez) si funciona el scroll despues de cargarse el preload y la pelicula... :? que es lo que me parece mas raro todavia...

bueno ^^ ahora si, alguna sugerencia?

Por Imer

38 de clabLevel



 

Cd. Obregón Sonora

firefox
Citar            
MensajeEscrito el 23 Oct 2008 12:05 am

penHolder escribió:

es porq no se detiene el EnterFrame, prueba modificando la funcion movement:

Código ActionScript :

function movement():Void { 
   // 
   txt.onEnterFrame = function() { 
      // 
      scrolled = (this._height-(mascara._height/1.3))/(mascara._height-dragger._height); 
      posy = -dragger._y*scrolled; 
      // 
      movin = new Tween(this, "_y", Strong.easeOut, this._y, posy, friction, true); 
   }; 
   if (posy == Math.round(txt._y)) {
         delete txt.onEnterFrame
      }
} 

:cry: no funciono penHolder...

Por Imer

38 de clabLevel



 

Cd. Obregón Sonora

firefox
Citar            
MensajeEscrito el 23 Oct 2008 04:58 pm
Holaa :crap: hey alguien :oops: se esta quedando atras mi post y aun no esta solucionado...

:(

Por Imer

38 de clabLevel



 

Cd. Obregón Sonora

firefox
Citar            
MensajeEscrito el 23 Oct 2008 06:15 pm
:nif: bueno. le quite el preload y al fin funciono... igual dejo el post para futuras generaciones :meditar:

saludos y tns penHolder, y a los demas :music:

Por Imer

38 de clabLevel



 

Cd. Obregón Sonora

firefox
Citar            
MensajeEscrito el 23 Oct 2008 07:36 pm
Carajo :twisted: volvio a fallar, meti varias mc's externas, cada una un scroll con texto e imagenes ( que para nada son el problema) y al cargar el primero todo es felicidad, pero con el segundo empieza a fallar, o no aparece el texto, o aparece abajo o el scroll es muy lento, etc :sueno:

ayuda :crap:

P.D. puede algun administrador borrar todas mis otras respuestas? Solo estan haciendo bulto innecesario ^^

Por Imer

38 de clabLevel



 

Cd. Obregón Sonora

firefox
Citar            
MensajeEscrito el 23 Oct 2008 11:47 pm
:D Ya encontre la solucion:

Cambiar esto:

Código :

movin = new Tween(this, "_y", Strong.easeOut, this._y, posy, friction, true);  


Por esto:

Código :

txt._y += (posy-txt._y)*.3;


y wala :wink:

Por Imer

38 de clabLevel



 

Cd. Obregón Sonora

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.