Comunidad de diseño web y desarrollo en internet online

espacio entre el título y el contenido con as3

Citar            
MensajeEscrito el 12 Ago 2009 10:44 pm
Hola, quisiera ver si alguien puede ayudarme, encontré un codigo de noticias y lo estoy modificando para jalar texto de un xml a un flash, pero en el código de las noticias, el texto de la cabeza no es multilinea, yo modifique eso para que si fuera, pero resulta que la cabeza se encima en el texto del contenido, y son variables que se crean automáticamente en un movie clip y es lo que necesito para que pueda ser fácilmente modificable, y no logro poner espacio entre la cabeza y el contenido, el código esta así, espero que alguien pueda ayudarme.

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 = flashmo_mask.width;
var item_height:Number = 0;
var item_spacing:Number = 15;
var item_padding:Number = 10;

var i:Number;
var total:Number;
var flashmo_xml:XML = new XML();
var xml_loader:URLLoader = new URLLoader();
xml_loader.load(new URLRequest("texto.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 );
   flashmo_mask.width = item_width;
   flashmo_item_group.mask = flashmo_mask;
   
   flashmo_sb.scrolling("flashmo_item_group", "flashmo_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 = 25 + 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 = 0xCCFF00;   // TITLE TEXT COLOR
fm_title_format.size = 30;

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


les pongo la foto de como se encima, de antemano gracias y saludos

Por leanan81

15 de clabLevel



 

firefox
Citar            
MensajeEscrito el 13 Ago 2009 12:42 am
hola de nuevo, ya logre resolver el espacio poniendo cada cosa como item por separado, y ya así tiene el espacio que estaba determinado entre una noticia y otra. igual no es la mejor solución pero queda como lo necesito, ahora lo que no logro es hacer que esos textos se muestren con las fuentes que ya están dentro del flash, a ver si alguien puede ayudarme con eso.

gracias y saludos

Por leanan81

15 de clabLevel



 

firefox
Citar            
MensajeEscrito el 13 Ago 2009 11:41 am
Selecciona el campo de texto dinámico y dale a "Character Embedding"en el panel de Propiedades (lo tengo en inglés, en español debe decir Caracteres o algo así), luego selecciona la fuente que quieres embeber. No hace falta importarlas a la biblioteca, a menos que estés usando un TextFormat en AS

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:18 pm
Gracias Jorge por tu respuesta, pero el campo de texto se genera dinámicamente y no puedo hacer eso. Y ya vi tu respuesta en mi otro post. :wink:

Por leanan81

15 de clabLevel



 

firefox

 

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