Foros del Web » Creando para Internet » Flash y Actionscript »

Problema con Marquesina Horizontal

Estas en el tema de Problema con Marquesina Horizontal en el foro de Flash y Actionscript en Foros del Web. Hola, quiero hacer una marquesina horizontal que lea la el texto de un txt externo, el texto trae etiquetas html, aqui les dejo el código ...
  #1 (permalink)  
Antiguo 14/04/2008, 15:52
 
Fecha de Ingreso: abril-2008
Mensajes: 8
Antigüedad: 16 años
Puntos: 0
Información Problema con Marquesina Horizontal

Hola, quiero hacer una marquesina horizontal que lea la el texto de un txt externo, el texto trae etiquetas html, aqui les dejo el código para ver si me pueden ayudar

texto.txt

texto=<em><strong><font color="#000000" size="28" face="Algerian" >Hola Mundo</font></strong></em>


---------------------------------------------------------------------------------------------------------

marquesina.fla

onClipEvent (load) {

System.useCodepage=true;
archivo="texto.txt"; //nombre del archivo

//carga del archivo .txt
carga = new LoadVars();
carga.html = true;
carga.onLoad = function(ok) {
if (ok) {
_root.html = true;
_root.text1 = eval("carga.texto");
};
};
carga.load(archivo);
}
onClipEvent (enterFrame) {

tmp = _root.text1.substr(0, 1);
_root.text1 = _root.text1.substr(1, _root.text1.length-1)+tmp;
trace (_root.text1);
}


diganme, que estoy haciendo mal???

gracias
  #2 (permalink)  
Antiguo 14/04/2008, 19:25
 
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
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:35.