Comunidad de diseño web y desarrollo en internet online

textformat no cambia nada

Citar            
MensajeEscrito el 17 Sep 2008 09:46 pm
Amigos, Tengo varios días tratando de que me funcione el "textformat" en un textfield creado dinámicamente y no funciona. He tratado de todo y no doy con la solución. Cualquiera que lo sepa utilizar, por favor una mano...........
este es el código de como lo estoy usando:

Código :

fullPreloader.onLoadStart = function(target) {
      target.createTextField("my_txt", target.getNextHighestDepth, -100, 108, 300, 50);
      target.my_txt.selectable = false;
      var style:TextFormat = new TextFormat();
         my_txt.style.font = "Twentieth Century Poster1 (embedded)";
         my_txt.style.size = 10;
         my_txt.style.bold = true;
         my_txt.style.color = 0xFFFF00;
         my_txt.setTextFormat(style);
   };

Gracias de antemano

Por zapata

46 de clabLevel



Genero:Masculino  

Venezuela

firefox
Citar            
MensajeEscrito el 18 Sep 2008 01:55 am
:) es así

Código ActionScript :

target.createTextField("my_txt",target.getNextHighestDepth,0,0,50,50);
target.my_txt.selectable = false;

var style:TextFormat = new TextFormat();

style.font = "verdana";
style.size = 20;
style.bold = true;
style.color = 0xFFFF00;

target.my_txt.text = "hola";
my_txt.setTextFormat(style);

Por eldervaz

BOFH

10964 de clabLevel

39 tutoriales
56 articulos

Genero:Masculino  

en algún lugar del mundo

clabbrowser
Citar            
MensajeEscrito el 18 Sep 2008 03:56 am
Gracias Elder, pero no funcionó. Además se me pasó explicar que el texto que aparece en el text field es traido desde un atributo de un XML. El texto aparece en su forma "default" y no logro que aparezca con el tipo y tamaño de texto que quiero cuando entra en la página, aún usando el " TextFormat ". ¿ Donde está el error ?

Por zapata

46 de clabLevel



Genero:Masculino  

Venezuela

firefox
Citar            
MensajeEscrito el 18 Sep 2008 09:39 am
La solución que te dio @eldervaz es la correcta, postea como quedó tu código ahora y explica en qué lugar le pones el texto a tu TextField porque no lo veo en tu primer código.

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox
Citar            
MensajeEscrito el 18 Sep 2008 01:32 pm

Por eldervaz

BOFH

10964 de clabLevel

39 tutoriales
56 articulos

Genero:Masculino  

en algún lugar del mundo

clabbrowser
Citar            
MensajeEscrito el 19 Sep 2008 02:44 am
Bueno sigo dando gracias, todo funciona correctamente. Las coordenadas del texfield son para que el texto salga a un lado de la imagen. El texto aparece corectamente, pero en el formato que quiero cambiar. Aquí está el codigo completo de lo que traté de explicar con lo sugerido incluido :

Código :

function callFullImage(myNumber) {
   myURL = myImages[myNumber].attributes.full2_url;
   myTitle = myImages[myNumber].attributes.title;
   _root.createEmptyMovieClip("fullImage_mc", _root.getNextHighestDepth());
   fullImage_mc._x = _root.full_x;
   fullImage_mc._y = _root.full_y;
   var fullClipLoader = new MovieClipLoader();
   var fullPreloader = new Object();
   fullClipLoader.addListener(fullPreloader);
   fullPreloader.onLoadStart = function(target) {
      target.createTextField("my_txt", target.getNextHighestDepth, -135, 88, 300, 50);
      target.my_txt.selectable = false;
      target.my_txt.multiline = true;
      var style:TextFormat = new TextFormat();
         style.font = "Twentieth Century Poster1 (embedded)";
         style.size = 10;
         style.bold = true;
         style.color = 0xFFFF00; 
         my_txt.setTextFormat(style);
   };
   fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
      target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
   };
   fullPreloader.onLoadComplete = function(target) {
      target.my_txt.text = myTitle;
   };
   fullClipLoader.loadClip("full_images2/"+myURL, fullImage_mc);
}

Yo le omití la linea target.my_txt.text = "hola"; sugerido por Elder, ya que se supone que aparezca en el text field lo que contiene el atributo (title).

Por zapata

46 de clabLevel



Genero:Masculino  

Venezuela

firefox
Citar            
MensajeEscrito el 19 Sep 2008 11:49 am

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox
Citar            
MensajeEscrito el 22 Sep 2008 06:49 pm
Muchas Gracias Chininet, de ninguna de las formas que he intentado, ni las sugeridas por Uds. funciona el cambio de formato en el texto cuando lo envía el xml. Voy a intentar hacerlo desde el propio xml, a ver si desde allí se puede determinar el formato.

Por zapata

46 de clabLevel



Genero:Masculino  

Venezuela

firefox
Citar            
MensajeEscrito el 22 Sep 2008 07:28 pm
Postea como quedó el código.

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox

 

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