Comunidad de diseño web y desarrollo en internet online

¡¡No consigo hacer un embeber con TLFTextField!!

Citar            
MensajeEscrito el 07 Jul 2011 11:33 am
tengo un problema al quererlo hacer en un TLFTextField. Quiero utilizar la fuente Zemke Hand ITC y no funciona, lo que ocurre es que aparece la Arial del sistema.... En la biblioteca selecciono la fuente y pongo TLF (DF4) ¿sabéis cómo resolverlo? Para que quedé claro os paso el AS3.

Código ActionScript :

 

import flash.text.*;
import fl.text.TLFTextField;

var MiZemke:Zemke=new Zemke(); 
var formato:TextFormat = new TextFormat(); 
formato.font=MiZemke.fontName; 
var txt:TLFTextField = new TLFTextField();
txt.autoSize = TextFieldAutoSize.LEFT; 
txt.defaultTextFormat = formato; 
txt.embedFonts = true; 
txt.text = "Este es un texto de prueba para embeber una fuente. "; 
addChild(txt); 


Gracias por adelantado :)

Por JoseCarb

20 de clabLevel



 

chrome
Citar            
MensajeEscrito el 07 Jul 2011 01:28 pm
Usualmente le das un identificador a la fuente en la biblioteca y usas ese string en la propiedad font

formato.font="MiZemke";

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 07 Jul 2011 03:17 pm
En AS3 flash no me deja introducir el identificador en la biblioteca, me dice que solo sepuede en AS2 o AS1. Lo que hago es crear una variable de la clase Zemke y luego dársela a "formato", funciona con TextField a la perfección pero con TLFTextoField...no me da error de compilación pero sale en Arial :(


formato.font=MiZemke.fontName;- lo tengo puesto entre las variables pero sigue sin funcionar. MiZemke es el nombre que le he puesto

Por JoseCarb

20 de clabLevel



 

chrome
Citar            
MensajeEscrito el 07 Jul 2011 03:25 pm
Ah, ok, es un TLFTextField ... ¿alguna razón en particular para usar TLF?

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 07 Jul 2011 05:25 pm
Sí, tengo ya mucho código donde configuro padding, columnas en la misma caja de texto y sé que voy a utilizar más funciones que TextField no me ofrece :(.

Por JoseCarb

20 de clabLevel



 

chrome
Citar            
MensajeEscrito el 07 Jul 2011 06:11 pm
Ok, sorry, pensé en un textfield común. Justo ahora estoy convirtiendi unos tutoriales al árabe (flow RTL) y tuve que usar TLF. B{asicamente importas la fuente en la biblioteca, en el tab ActionScript marcas exportar para ActionScript y automáticamente le pone la clase (generalmente el nombre mismo de la fuente) y luego lo usas como String, pero en un TextLayoutFormat. Aquí un snippet de mi clase LangFormatter donde formateo el texto (para {arabe o inglés):

Código ActionScript :

public function getFormat():TextLayoutFormat {
         var textFormat:TextLayoutFormat = new TextLayoutFormat();
         textFormat.fontSize = 18;
         textFormat.textAlign = TextAlign.RIGHT;
         switch(lang) {
            case "ar":
               textFormat.fontFamily = "Arabic"
               textFormat.locale = "ar";
               textFormat.direction = Direction.RTL;
               break;
            case "en":
               textFormat.fontFamily ="NewsGoth"
                textFormat.direction = Direction.LTR   
               break;
         } 
         return textFormat;
      }


Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 07 Jul 2011 08:34 pm
Joge muchísimas gracias!! tengo que entrenar este trabajo pronto y me estaba poniendo realmente nervioso...

Por JoseCarb

20 de clabLevel



 

chrome

 

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