Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/09/2008, 12:16
worldPeace_Plis
Usuario no validado
 
Fecha de Ingreso: marzo-2007
Mensajes: 238
Antigüedad: 17 años, 1 mes
Puntos: 5
Respuesta: Ajustar tamaño de texto a caja dinámica

Si tienes una caja de texto fija, digamos 350 x 400, puedes utilizar. Ahi te va un ejemplillo a ver si te sirve ;)

Código PHP:
this.createTextField("scroll_txt"this.getNextHighestDepth(), 101016020);
this.createTextField("box_txt"this.getNextHighestDepth(), 1030350400);
box_txt.multiline true;
box_txt.wordWrap true;
box_txt.border 1;
//
var txtSize:Number 15;
var 
format_fmt:TextFormat = new TextFormat();
    
format_fmt.font "Verdana";
    
format_fmt.size txtSize;

//
for (var 0i<10i++) {
    
box_txt.text += "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh "
            
"euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.";
}
box_txt.setTextFormat(format_fmt);
trace (box_txt.maxscroll);
scrollUp_btn.onRelease = function() {
    
box_txt.scroll--;
    
scroll_txt.text box_txt.scroll+" of "+box_txt.maxscroll;
};
scrollDown_btn.onRelease = function() {
    
box_txt.scroll++;
    
scroll_txt.text box_txt.scroll+" of "+box_txt.maxscroll;
};

this.onEnterFrame = function () {
    if (
box_txt.maxscroll>1) {
        
txtSize-=.25;
        
format_fmt.size txtSize;
        
box_txt.setTextFormat(format_fmt);
        
scroll_txt.text 'format_fmt.size = '+txtSize;
        
scroll_txt.autoSize true;
    } else {
        
trace ('format_fmt.size = '+txtSize);
        
delete onEnterFrame;
    }

Salu2!