Comunidad de diseño web y desarrollo en internet online

centrar verticalmente un texto dinamico

Citar            
MensajeEscrito el 03 Feb 2012 02:41 pm
Hola!!

Quiero centrar verticalmente un texto dinamico que me llega desde XML. L estoy ententando asi pero no me sale:

copy4.mensaje es mi texto dinamico

Código ActionScript :

 private var init_height:Number;


...

      init_height= copy4.mensaje.height;
      copy4.mensaje.autoSize = "center";
         if(copy4.mensaje.height>init_height){
            copy4.mensaje.y = copy4.mensaje.y-((copy4.mensaje.height-init_height)/2);
         }




Eso necesito llamarlo dentro de esta funcion

Código ActionScript :

      private function showAnswer() {
      anterior = _randomNum;
      
      
      
      switch (seleccion) {
   
         case "amor" :
            //trace(" anterior "+anterior+" _randomNum "+_randomNum);
            randRange(0, (xml.amor.length())-1);
            if (anterior == _randomNum) {
               randRange(0, (xml.amor.length())-1);
            } else {
               //trace(_randomNum);
               //trace(questSalud);
               copy4.mensaje.text = questAmor[_randomNum];
               frase = questAmor[_randomNum];
            }
            
            break;
.......



Gracias por la ayuda chicos, se que estoy cerca, falta algo tonto

Por dianita666

Claber

185 de clabLevel



 

firefox
Citar            
MensajeEscrito el 19 Feb 2012 04:01 am
si te he entendido bien...quieres centrar verticalmente un texto segun su altura con su posicion

Código ActionScript :

//Guardo Altura Anterior
init_height= copy4.mensaje.height;
//Ajusto a la nueva Altura
copy4.mensaje.autoSize = "center";
//Vario posicion segun altura nueva
 copy4.mensaje.y+= (init_height-copy4.mensaje.height)/2;
//recupero el autoSize para el siguiente ajuste
copy4.mensaje.autoSize = "none";


espero que te sirva y te haya aclarado tus dudas

saludos

Por Yonomimi

76 de clabLevel



Genero:Masculino  

firefox

 

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