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

Pequeño problema al cargar un txt externo

Estas en el tema de Pequeño problema al cargar un txt externo en el foro de Flash y Actionscript en Foros del Web. Buenas a todos, mi problema es el siguiente. Estoy realizando una web en flash dinámica. Para los textos estoy usando un scroll que carga los ...
  #1 (permalink)  
Antiguo 23/03/2009, 07:00
 
Fecha de Ingreso: marzo-2009
Mensajes: 5
Antigüedad: 15 años, 1 mes
Puntos: 0
Pequeño problema al cargar un txt externo

Buenas a todos,

mi problema es el siguiente. Estoy realizando una web en flash dinámica. Para los textos estoy usando un scroll que carga los txt externos.

La carga funciona perfectamente, el problema me lo encuentro en la siguiente situación.
Tengo cinco swf que cargo mediante el siguiente código en el flash principal:

_root.createEmptyMovieClip("contenedor",10);
contenedor._x=132
contenedor._y=380.1;

btn_comunicacion.onRelease=function(){
contenedor.loadMovie("swf/comunicacion_02.swf",1);
}

En el flahs externo, el texto carga correctamente, pero para que cargue dentro del flash principal me he visto obligado a duplicar el .txt en el directorio de carpetas, quedando de la siguiente manera:

contenido CARPETA PRINCIPAL

- principal.swf
- carpeta txt: comunicacion.txt
- carpeta swf:
comunicacion.swf
carpeta txt: comunicacion.txt

En el swf externo el código que he usado para generar el scroll y cargar el txt es el siguiente:

System.useCodepage = true;

//SCROLLBAR FUNCTIONS

//cover text with a mask to hide extended text
txt.setMask(mask);

//If text is higher than the mask, then show scrollbar
//else, if text is smaller, hide the scrollbar
this.onEnterFrame = function() {
if (txt._height<=mask._height) {
scrollbar.scrollbarBtn._visible = false;
scrollbar.scrollbarBack._visible = false;
} else {
scrollbar.scrollbarBtn._visible = true;
scrollbar.scrollbarBack._visible = true;
}
};

//When user presses on the scrollbar
scrollbar.scrollbarBtn.onPress = function() {
if (this.hitTest(_root._xmouse, _root._ymouse) && txt._height>mask._height) {
//user is only able to drag on the scrollbar background
this.startDrag(false,scrollbar.scrollbarBG._x,scro llbar.scrollbarBG._y,scrollbar.scrollbarBG._x,scro llbar.scrollbarBG._height-this._height);
//Call scrollThumbs function for easing
txt.onEnterFrame = scrollThumbs;
dragging = true;
}
};

//When the user releases the scrollbar
scrollbar.scrollbarBtn.onRelease = scrollbar.scrollbarBtn.onReleaseOutside=function () {
stopDrag();
dragging = false;
scrollbar.scrollbarBtn.gotoAndPlay("out");
delete this.onEnterFrame;
};
//on rollover
scrollbar.scrollbarBtn.onRollOver = function() {
scrollbar.scrollbarBtn.gotoAndPlay("over");
};
//on rollout
scrollbar.scrollbarBtn.onRollOut = function() {
scrollbar.scrollbarBtn.gotoAndPlay("out");
};

//text easing function
function scrollThumbs() {

var funkyVar = -this._parent.scrollbar.scrollbarBtn._y*(((this._he ight-this._parent.scrollbar.scrollbarBtn._height)/(this._parent.scrollbar.scrollbarBG._height-this._parent.scrollbar.scrollbarBtn._height))-1);
// change .2 for speed
this.Y = (funkyVar-this._y)*.2;
this._y += this.Y;
if (Math.abs(funkyVar-this._y)<1 && !dragging) {
delete this.onEnterFrame;
}

}

//----------------MOUSE SCROLL LISTENER

//clearListener is called from the INDEX file when clicked on the
//"About Us" button. This removes the old Mouse listener so that
//the mouse listeners would not overlap.
function clearListener() {
Mouse.removeListener(mouseListener);
}

var mouseListener:Object = new Object();

//When user uses the mouse wheel
mouseListener.onMouseWheel = function(delta) {
//change the 3 for how much to scroll on single scroll
scrollbar.scrollbarBtn._y -= delta*3;
if (scrollbar.scrollbarBtn._y<0) {
scrollbar.scrollbarBtn._y = 0;
}
if (scrollbar.scrollbarBtn._y+scrollbar.scrollbarBtn. _height>mask._height) {
scrollbar.scrollbarBtn._y = mask._height-scrollbar.scrollbarBtn._height;
}
//call ease text function
txt.onEnterFrame = scrollThumbs;
};

// adding the listener to the Mouse object
Mouse.addListener(mouseListener);

Me imagino que el problema estará en alguna de las rutas del código, pero soy nuevo en el action scrip y se me escapan millones de cosas :D.

El otro problema que me encuentro es el tema de los carácteres extraños. EL texto no me carga las tildes ni las Ñ. He intentado varias soluciones que he encontrado por la web pero no me funcionado. ¿Cómo y con editor de texto hay que editar los textos para que se vean correctamente en el flash?

Gracias de antemano

Saludos
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 23:28.