Comunidad de diseño web y desarrollo en internet online

fuentes embebidas con variables

Citar            
MensajeEscrito el 13 Ago 2009 01:53 am
hola, tengo un pequeño problema tengo el siguiente código en el que importo desde un xml texto, pero como es variable, básicamente todo esta como variable, pero no se como hacer para poner que me ponga esos textos con las fuentes que tengo contenidas en flash y de plano tuve que ponerlas con arial, que bueno no es lo que quiero :cry: , a ver si alguien puede ayudarme, gracias

Código ActionScript :

// Copyright © flashmo.com
// Developed by Min Thu

var flashmo_item_list = new Array();
var flashmo_item_group:MovieClip = new MovieClip();

var item_width:Number = text_mask.width;
var item_height:Number = 0;
var item_spacing:Number = 0;
var item_padding:Number = 0;

var i:Number;
var total:Number;
var flashmo_xml:XML = new XML();
var xml_loader:URLLoader = new URLLoader();
xml_loader.load(new URLRequest("comida.xml"));
xml_loader.addEventListener(Event.COMPLETE, push_array);

function push_array(e:Event):void 
{
   flashmo_xml = XML(e.target.data);
   total = flashmo_xml.item.length();

   for( i = 0; i < total; i++ )
   {
      flashmo_item_list.push( {
         title: flashmo_xml.item[i].title.toString(), 
         description: flashmo_xml.item[i].description.toString()
      } );
   }
   create_item_list();
}

function create_item_list():void
{
   for( i = 0; i < total; i++ )
   {
      var flashmo_item = new MovieClip();
      
      flashmo_item.addChild( create_item_title( flashmo_item_list[i].title ) );
      flashmo_item.addChild( create_item_desc( flashmo_item_list[i].description ) );
      
      flashmo_item.y = item_height;
      item_height += flashmo_item.height + item_spacing;
      
      flashmo_item_group.addChild( flashmo_item );
   }
   
   this.addChild( flashmo_item_group );
   text_mask.width = item_width;
   flashmo_item_group.mask = text_mask;
   
   flashmo_sb.scrolling("flashmo_item_group", "text_mask", 0.50);   // ScrollBar Added
}

function create_item_title( item_title:String )
{
   var fm_text = new TextField();
   
   fm_text.defaultTextFormat = fm_title_format;
   fm_text.x = fm_text.y = item_padding;
   fm_text.width = item_width - item_padding * 2;
   fm_text.text = item_title;
   fm_text.multiline = true;
   fm_text.wordWrap = true;
   fm_text.selectable = false;
   fm_text.autoSize = TextFieldAutoSize.LEFT;
   
   return fm_text;
}

function create_item_desc( item_desc:String )
{
   var fm_text = new TextField();
   
   fm_text.defaultTextFormat = fm_desc_format;
   fm_text.x = item_padding;
   fm_text.y = 3 + item_padding;
   fm_text.width = item_width - item_padding * 2;
   fm_text.text = item_desc;
   fm_text.multiline = true;
   fm_text.wordWrap = true;
   fm_text.selectable = false;
   fm_text.autoSize = TextFieldAutoSize.LEFT;
   
   return fm_text;
}


var fm_title_format:TextFormat = new TextFormat();
fm_title_format.font = "Arial";
fm_title_format.color = 0xBECD41;   // TITLE TEXT COLOR
fm_title_format.size = 25;
fm_title_format.bold = true;

var fm_desc_format:TextFormat = new TextFormat();
fm_desc_format.font = "Arial";
fm_desc_format.color = 0xCCCCCC;   // DESCRIPTION TEXT COLOR
fm_desc_format.size = 12;
fm_desc_format.align = TextFormatAlign.LEFT;
fm_desc_format.leading = 2;

Por leanan81

15 de clabLevel



 

firefox
Citar            
MensajeEscrito el 13 Ago 2009 11:26 am
En vez de Arial ponle el nombre de clase que le pusiste a la fuente (en la biblioteca, al importar la fuente, debes seleccionar Exportar para actionscript y donde dice clase le pones el identificador)

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 13 Ago 2009 04:15 pm
Hola Jorge mil gracias por tu respuesta, eso lo hice, pero no me las respeta... no entiendo porque. Y como estoy usando as3, no me deja poner el identificador. No se que podrá ser. :cry:

Por leanan81

15 de clabLevel



 

firefox
Citar            
MensajeEscrito el 13 Ago 2009 04:40 pm
Identificador no, clase. Asegúrate de haber borrado cache antes de chequearlo

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 14 Ago 2009 03:25 pm
Hola Jorge, a ver del nombre de la clase tiene el mismo nombre que el nombre de la fuente, como se lo puse que en este caso es "Frutiger67" y me pone la fuente como si fuera una vil times :( , ya probé usando "fm_desc_format.font", "fm_desc_format" y "TextFormat"... y no funciona, pongo el codigo de nuevo, a ver si me puedes ayudar. Gracias por tu ayuda y saludos

Código ActionScript :

function create_item_desc( item_desc:String )
{
   var fm_text = new TextField();
   
   fm_text.defaultTextFormat = fm_desc_format;
   fm_text.x = item_padding;
   fm_text.y = 3 + item_padding;
   fm_text.width = item_width - item_padding * 2;
   fm_text.text = item_desc;
   fm_text.multiline = true;
   fm_text.wordWrap = true;
   fm_text.selectable = false;
   fm_text.autoSize = TextFieldAutoSize.LEFT;
   
   return fm_text;
}


var fm_title_format:TextFormat = new TextFormat();
fm_title_format.font = "Arial";
fm_title_format.color = 0xBECD41;   // TITLE TEXT COLOR
fm_title_format.size = 25;
fm_title_format.bold = true;

var fm_desc_format:TextFormat = new TextFormat();
fm_desc_format.font = "Frutiger67";
fm_desc_format.color = 0xCCCCCC;   // DESCRIPTION TEXT COLOR
fm_desc_format.size = 13;
fm_desc_format.align = TextFormatAlign.JUSTIFY;
fm_desc_format.leading = 2;

Por leanan81

15 de clabLevel



 

firefox
Citar            
MensajeEscrito el 17 Ago 2009 11:17 am
Asigna primero el texto, dale luego el TextFormat, no al revés

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 21 Ago 2009 04:05 pm
Cambia el nombre en vez de "Arial" usa "Ari", parece una tontera, pero parece que hay una colisión entre la letra por defecto y la letra de linkage, con esa ambiguedad no se ve el texto. A la del linkage cambiale el nombre, en vez de Arial poné "Ari"

Por La_Gata

123 de clabLevel



 

msie7

 

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