Comunidad de diseño web y desarrollo en internet online

Utilitarios

Citar            
MensajeEscrito el 07 Jul 2008 04:20 pm
Quiero empezar un post con los "utiliarios", funciones, programas, etc, que utilizamos diariamente para facilitar la labor de desarrollo y diseño diario.

Espero colaboren bastante.

Por miliciano

50 de clabLevel



Genero:Masculino  

Colombia

firefox
Citar            
MensajeEscrito el 07 Jul 2008 04:21 pm
Para cuando necesitamos formatear correctamente nombres de usuarios:

Código :

temp = "AndRés BEDOYA";
strEncode = temp.split(" ");
msg = "";
for(var i=0;i<strEncode.length;i++){
   ini = strEncode[i].substr(0,1).toUpperCase();
   cuerpo = strEncode[i].substr(1,length(strEncode[i])-1).toLowerCase();
   msg += ini+cuerpo+" ";
}

trace(msg);



Y la salida es:

Código :

Andrés Bedoya 


Fuente: http://www.lasmovies.com/blog/?p=130

Por miliciano

50 de clabLevel



Genero:Masculino  

Colombia

firefox
Citar            
MensajeEscrito el 07 Jul 2008 04:25 pm
Cuando necesitamos animar rapidamente un cuadro de dialogo o ventana con efectos de In y out.

Código :

MovieClip.prototype.fxIn = function(){
   //this._visible = true;
   easeType = mx.transitions.easing.Bounce.easeOut;
   new mx.transitions.Tween(this, "_width", easeType, 0,this.w, .5, true);
   new mx.transitions.Tween(this, "_height", easeType, 0,this.h, .5, true);

}

MovieClip.prototype.fxOut = function(){

   easeType = mx.transitions.easing.Bounce.easeOut;
   t1 = new mx.transitions.Tween(this, "_width", easeType, this._width,0, .5, true);
   t2 = new mx.transitions.Tween(this, "_height", easeType, this._height,0, .5, true);
   t2.onMotionFinished = function()
   {
      this._parent._visible = false;
   }
}


Nota: El fxIn, se usa en un botón que abra la ventana, y el fxOut en el botón que la cierra.

Fuente: http://www.lasmovies.com/blog/?p=8

Por miliciano

50 de clabLevel



Genero:Masculino  

Colombia

firefox
Citar            
MensajeEscrito el 08 Jul 2008 04:48 pm
Ok, por acá dejando otra herramienta muy útil, cuando necesitamos saber las coordenadas de un objeto.

Lo único que hay que hacer es crear dos campos de texto dinámico, para mostrar la información del clip de película que estamos analizando.

Yo muestro las propiedades, _x, _y, _width y _height.

Los nombres de los campos son:

prueba y prueba 2.

Y acá esta el código que permite arrastar y visualizar las propiedades de un movieClip x;

Código :


MovieClip.prototype.arrastrar = function()
{  
      this.onPress = function(){
   
         startDrag(this,false);
  
         this.onEnterFrame = function()
         {
   
            prueba._visible = true;
  
            prueba2._visible = true;
  
            prueba.text = " w : "+this._width+" h : "+this._height;
  
            prueba2.text = " x : "+this._x+" y : "+this._y;
  
         }
   }
 
      this.onRelease = function(){
  
         this.stopDrag();
  
         delete this.onEnterFrame;
  
         prueba._visible = false;
  
         prueba2._visible = false;
  
      }
  
      this.onReleaseOutside = function(){
 
         this.stopDrag();
 
         delete this.onEnterFrame;
  
         prueba._visible = false;
  
         prueba2._visible = false;
  
      }
  }



Fuente:

http://www.lasmovies.com/blog/?p=24

Ok, suerte

Por miliciano

50 de clabLevel



Genero:Masculino  

Colombia

firefox
Citar            
MensajeEscrito el 10 Jul 2008 03:38 pm
El aporte de hoy:

Si queremos saber cuando el mouse esta cerca de un movieClip:

Código :

function distancia(xo,xf,yo,yf){
   u1 = xf-xo;
   u2 = yf-yo;
   xr = u1*u1;
   yr = u2*u2;
   
   return Math.sqrt(xr+yr);
}

onEnterFrame = function()
{
   xo = mcball._x;
   yo = mcball._y;
   xf = _root._xmouse;
   yf = _root._ymouse;
   
   if(distancia(xo,yo,xf,yf)<30)
   {
      trace("Esta cerca del movieClip");
   }
}


Creamos un movieclip, lo ponemos en el escenario y le ponemos de nombre de instancia, mcball.

Por miliciano

50 de clabLevel



Genero:Masculino  

Colombia

firefox
Citar            
MensajeEscrito el 11 Jul 2008 07:02 pm
Para donde va el mouse?

A continuación un script que nos permite saber para donde esta moviendo el mouse un usuario:

Fuente: http://www.lasmovies.com/blog/?p=137

Código :


_root.xcdir = 1;
_root.ycdir = 1;

function catchLastMousePosition(){
   _root.xlmouse = _root._xmouse;
   _root.ylmouse = _root._ymouse;
   //trace("xi "+_root.xlmouse+" yi "+_root.ylmouse);
}

_root.id = setInterval(catchLastMousePosition,500);

MovieClip.prototype.follow = function(xpos,ypos){
   
   var step = 50;
   var dx = xpos;
   var dy = ypos;
   
   var xdir = (_root.xlmouse - _root._xmouse);
   var ydir = (_root.ylmouse - _root._ymouse);
   
   _root.deltax = true;
   _root.deltay = true;
   
   //trace("xdir "+xdir+" ydir "+ydir);
   if(xdir>0 && ydir>0){
   //vamos en diagonal hacia la derecha de abajo
      trace("vamos en diagonal hacia la derecha de abajo");
      _root.xcdir = 1;
      _root.ycdir = 1;
      this._x = _root._xmouse + step + dx;
      this._y = _root._ymouse + step + dy;
   }
   if(xdir<0 && ydir<0){
   //vamos en diagonal hacia la izquierda de abajo
      trace("vamos en diagonal hacia la izquierda de abajo");
      _root.xcdir = -1;
      _root.ycdir = 1;
      this._x = _root._xmouse - step + dx;
      this._y = _root._ymouse - step + dy;
   }
   if(xdir>0 && ydir<0){
   //vamos en diagonal hacia la derecha de arriba
   trace("vamos en diagonal hacia la derecha de arriba");
      _root.xcdir = 1;
      _root.ycdir = -1;
      this._x = _root._xmouse + step + dx;
      this._y = _root._ymouse - step + dy;
   }
   if(xdir<0 && ydir>0){
   //vamos en diagonal hacia la izquierda de arriba
      trace("vamos en diagonal hacia la izquierda de arriba");
      _root.xcdir = -1;
      _root.ycdir = 1;
      this._x = _root._xmouse - step + dx;
      this._y = _root._ymouse + step + dy;
   }
   if(xdir>0 && ydir==0){
   //vamos hacia la derecha horizontalmente
   trace("vamos hacia la izquierda horizontalmente");
      _root.xcdir = -1;
      _root.ycdir = 1;
      _root.deltax = true;
      _root.deltay = false;
      this._x = _root._xmouse + step + dx;
      this._y = _root._ymouse + dy;
   }
   if(xdir<0 && ydir==0){
   //vamos hacia la izquierda horizontalmente
   trace("vamos hacia la derecha horizontalmente");
      _root.xcdir = 1;
      _root.ycdir = 1;
      _root.deltax = true;
      _root.deltay = false;
      this._x = _root._xmouse - step + dx;
      this._y =  _root._ymouse + dy;
   }
   if(xdir==0 && ydir>0){
   //vamos hacia abajo en linea recta
      trace("vamos hacia abajo en linea recta");
      _root.xcdir = 1;
      _root.ycdir = 1;
      _root.deltax = false;
      _root.deltay = true;
      this._x = _root._xmouse + dx;
      this._y = _root._ymouse + step + dy;
   }
   if(xdir==0 && ydir<0){
   //vamos hacia arriba en linea recta
      trace("vamos hacia arriba en linea recta");
      _root.xcdir = 1;
      _root.ycdir = -1;
      _root.deltax = false;
      _root.deltay = true;
      this._x = _root._xmouse + dx;
      this._y = _root._ymouse - step + dy;
   }
}

MovieClip.prototype.moveBitch = function()
{
   if(_root.xcdir>0 && _root.deltax)
      this._x++;
   if(_root.xcdir<0 && _root.deltax)
      this._x--;
      
   if(_root.ycdir>0 && _root.deltay)   
      this._y++;
   if(_root.ycdir<0 && _root.deltay)
      this._y--;
}

this.onEnterFrame = function()
{
   this.follow(xpos,ypos);
   mc.img.moveBitch();      
}



mc.img //-> Movieclip que se mueve según la dirección que se mueva el mouse

Por miliciano

50 de clabLevel



Genero:Masculino  

Colombia

firefox
Citar            
MensajeEscrito el 11 Jul 2008 07:43 pm
Hoy utilicé este truco, es útil, cuando queremos garantizar que getURL abra correctamente un link.

Código :


if(url.indexOf("http://")!=-1)    
  getURL(url,"_self");
else
   getURL("http://"+url,"_self");



Probar con valores para url como:

Código :

        url = "www.google.com";


También hay que ver que pasa cuando tenemos un swf en un dominio y hacemos:

Código :


getURL("www.google.com","_self");

Por miliciano

50 de clabLevel



Genero:Masculino  

Colombia

firefox

 

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