Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/04/2008, 19:25
Arleqin
 
Fecha de Ingreso: abril-2008
Mensajes: 8
Antigüedad: 16 años
Puntos: 0
Re: Problema con Marquesina Horizontal

Ya logre hacer lo que necesitaba, aqui les dejo el código, igual a alguien mas le ayuda


Aqui lee el archivo con formato html:

System.useCodepage=true;
this.createTextField("ticker_txt", 0, 30, 7, 280, 50);
var ticker_txt:TextField = new TextField();
ticker_txt.speed = 1;

archivo="texto.txt"; //nombre del archivo

//carga del archivo .txt
carga = new LoadVars();
carga.html = true;
carga.onLoad = function(ok) {
if (ok) {

ticker_txt.html = true;
ticker_txt.htmlText = eval("carga.texto");
trace(ticker_txt.text);
};
};
carga.load(archivo);

ticker_txt.spaceSize = ticker_txt.getNewTextFormat().getTextExtent(" ").width;
ticker_txt.spacesRequired = Math.ceil(ticker_txt._width / ticker_txt.spaceSize);
trace(ticker_txt._width);
for (var i = 0; i < ticker_txt.spacesRequired; i++) {
ticker_txt.spacebuffer += " ";
}
ticker_txt.text = ticker_txt.spacebuffer + ticker_txt.text + ticker_txt.spacebuffer;
ticker_txt.hscrollInterval = function () {
if (this.hscroll == this.maxhscroll) {
this.hscroll = 0;
}
this.hscroll += this.speed;
}
setInterval(ticker_txt, "hscrollInterval", 5);


************************************************** **********

Aqui asignadole el formato a la fuente:

zize = 20;
this.createTextField("my_txt", this.getNextHighestDepth(), 30, 9, 280, zize+10);
//my_txt.autoSize = true;

archivo="texto.txt"; //nombre del archivo

//carga del archivo .txt
carga = new LoadVars();
carga.html = true;
carga.onLoad = function(ok) {
if (ok) {

my_txt.text = eval("carga.texto");
trace(ticker_txt.text);
};
};
carga.load(archivo);
//my_txt.text = "Muchos de los temas de Utilización de Flash, Formación acerca de ActionScript 2.0 y Programación ActionScript 3.0 se refieren a muestras que puede descargar en esta página.";

my_txt.speed = 1;

my_txt.spaceSize = my_txt.getNewTextFormat().getTextExtent(" ").width;
my_txt.spacesRequired = Math.ceil(my_txt._width / my_txt.spaceSize);


for (var i = 0; i < my_txt.spacesRequired; i++) {
my_txt.spacebuffer += " ";
}

my_txt.text = my_txt.spacebuffer + my_txt.text + my_txt.spacebuffer;

my_txt.hscrollInterval = function () {
if (this.hscroll == this.maxhscroll)
{
this.hscroll = 0;
}
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Algerian";
my_fmt.size = zize;
my_fmt.bold = true;
my_fmt.color = 0xFF00FF;
my_fmt.italic = true;
//my_fmt.underline = true;
my_txt.setTextFormat(my_fmt);

this.hscroll += this.speed;
}
setInterval(my_txt, "hscrollInterval", 5);

suerte y ojalá les sea de gran ayuda...

chao