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

Porque no me toma los acentos

Estas en el tema de Porque no me toma los acentos en el foro de Flash y Actionscript en Foros del Web. Estimados Creo tener todo bien pero el flash no me toma los acentos. por mas que he cambiado UTF-8, y demas tanto en el html ...
  #1 (permalink)  
Antiguo 15/09/2009, 22:12
Avatar de rec321  
Fecha de Ingreso: mayo-2005
Ubicación: Argentina
Mensajes: 91
Antigüedad: 18 años, 10 meses
Puntos: 1
Porque no me toma los acentos

Estimados

Creo tener todo bien pero el flash no me toma los acentos.
por mas que he cambiado UTF-8, y demas tanto en el html como en el xml
no lofro hacerlo funcionar.
Si alguien puede darme una ayuda o bien aqui o le envio el swf y el xml para que lo evalue.
Gracias

news.swf
Código:
var config:XML = new XML();
config.ignoreWhite = true;
config.onLoad = loadConfig;
config.load("xml/news/config.xml");
function loadConfig(success:Boolean):Void {
	if (success) {
		var all:XMLNode = config.firstChild;
		mainX = Number(all.childNodes[0].firstChild.nodeValue);
		mainY = all.childNodes[1].firstChild.nodeValue;
		noPosts = Number(all.childNodes[2].firstChild.nodeValue);
		postSpacing = Number(all.childNodes[3].firstChild.nodeValue);
		sumLength = all.childNodes[4].firstChild.nodeValue;
		sumApend = all.childNodes[5].firstChild.nodeValue;
		moreBtnNormal = all.childNodes[6].firstChild.nodeValue;
		moreBtnOver = all.childNodes[7].firstChild.nodeValue;
		moreBtnTextColor = all.childNodes[8].firstChild.nodeValue;
		moreBtnColorSpeed = Number(all.childNodes[9].firstChild.nodeValue);
		alwaysShowMore = all.childNodes[10].firstChild.nodeValue;
		arrowGlowColor = Number(all.childNodes[11].firstChild.nodeValue);
		arrowGlowNormalAlpha = Number(all.childNodes[12].firstChild.nodeValue);
		arrowGlowInAlpha = Number(all.childNodes[13].firstChild.nodeValue);
		postSlideSpeed = Number(all.childNodes[14].firstChild.nodeValue);
		fadeOutOldPost = Number(all.childNodes[15].firstChild.nodeValue);
		fadeInNewPost = Number(all.childNodes[16].firstChild.nodeValue);
		slideOutSpeed = Number(all.childNodes[17].firstChild.nodeValue);
		slideInSpeed = Number(all.childNodes[18].firstChild.nodeValue);
		fadeInSpeed = Number(all.childNodes[19].firstChild.nodeValue);
		fadeOutSpeed = Number(all.childNodes[20].firstChild.nodeValue);
		loadEverything();
	} else {
		trace("XML NOT LOADED");
	}
}
import mx.transitions.Tween;
import mx.transitions.easing.*;
import caurina.transitions.Tweener;
import caurina.transitions.properties.ColorShortcuts;
ColorShortcuts.init();
import flash.filters.GlowFilter;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();
loadEverything = function () {
	trace(noPosts);
	scope = this.createEmptyMovieClip("scope", 1);
	scope._x = mainX;
	scope._y = mainY;
	var news:XML = new XML();
	news.ignoreWhite = true;
	news.onLoad = buildposts;
	news.load("xml/news/news.xml");
	postNum = 1;
	function buildposts(success:Boolean):Void {
		if (success) {
			var allXML:XMLNode = news.firstChild;
			postTotal = allXML.childNodes.length;
			allPosts = scope.createEmptyMovieClip("allPosts", 2);
			var i:Number;
			for (i=0; i<postTotal; i++) {
				var post:MovieClip = allPosts.attachMovie("post", "post"+i, i+100);
				post.bg._alpha = 0;
				post.description.t.html = true;
				post.description.t.autoSize = true;
				post.headline = allXML.childNodes[i].childNodes[0].firstChild.nodeValue;
				post.des = allXML.childNodes[i].childNodes[1].firstChild.nodeValue;
				post.num = postNum++;
				post.title.t.autoSize = true;
				post.title.t.text = post.headline;
				newsCSS = new TextField.StyleSheet();
				cssURL = "css/news/news.css";
				newsCSS.load(cssURL);
				newsCSS.onLoad = function(success) {
					if (success) {
						post.description.t.styleSheet = newsCSS;
					}
				};
				if (post.des.length>sumLength) {
					sum = post.des.substring(0, sumLength);
					lastSpace = sum.lastIndexOf(" ");
					post.description.t.htmlText = sum.substring(0, lastSpace)+sumApend;
				} else {
					post.description.t.htmlText = post.des;
					if (alwaysShowMore == "false") {
						post.moreBtn._visible = false;
					}
				}
				// end of summary code
				post.title.onRelease = post.moreBtn.onRelease=function () {
					buildlargePost(this._parent);
				};
				moreColor = new Color(post.moreBtn.bg);
				moreColor.setRGB(moreBtnNormal);
				post.moreBtn.txt.t.textColor = moreBtnTextColor;
				post.moreBtn.onRollOver = function() {
					Tweener.addTween(this.bg, {_color:moreBtnOver, time:moreBtnColorSpeed, transition:"linear"});
				};
				post.moreBtn.onRollOut = function() {
					Tweener.addTween(this.bg, {_color:moreBtnNormal, time:moreBtnColorSpeed, transition:"linear"});
				};
				post._y = allPosts['post'+(i-1)]._y+allPosts['post'+(i-1)]._height+postSpacing;
				if (i<noPosts) {
					post._alpha = 100;
				} else {
					post._alpha = 0;
				}
			}
			nav = scope.attachMovie("nav", "nav", 4);
			nav._y = (post.bg._height*noPosts)+(postSpacing*noPosts)-5;
			navMask = scope.attachMovie("postsMask", "navMask", 10);
			navMask._y = nav._y;
			navMask._x = nav._x;
			navMask._width = post.bg._width;
			navMask._height = 30;
			nav.setMask(navMask);
			glowIn = new GlowFilter(arrowGlowColor, arrowGlowInAlpha, 5, 5, 5, 10, false, false);
			glowOut = new GlowFilter(arrowGlowColor, arrowGlowNormalAlpha, 5, 5, 5, 10, false, false);
string manipulation
"+postTotal+" "+counterEnd;
			nav.postNav.newerBtn._alpha = 30;
			nav.postNav.newerBtn.enabled = false;
			Tweener.addTween(nav.postNav.newerBtn, {_filter:glowOut, time:0});
			Tweener.addTween(nav.postNav.olderBtn, {_filter:glowOut, time:0});
			var id:Number = 0;
			nav.postNav.olderBtn.onRelease = function():Void  {
				if (id>=0 && id<postTotal-noPosts) {
					Tweener.addTween(nav.postNav.newerBtn, {_alpha:100, time:1});
					nav.postNav.newerBtn.enabled = true;
					endPos = ((id+1)*post.bg._height)+(postSpacing*(id+1));
					slide(allPosts, allPosts._y, -endPos, postSlideSpeed, "_y", Strong.easeInOut);
					fade(allPosts['post'+id], 100, 0, fadeOutOldPost, Strong.easeOut);
					var newPost:Number = id+noPosts;
					fade(allPosts['post'+newPost], 0, 100, fadeInNewPost, Strong.easeInOut);
ID
					id++;
				}
				if (id == postTotal-noPosts) {
					Tweener.addTween(this, {_filter:glowOut, time:3});
					this.enabled = false;
					Tweener.addTween(this, {_alpha:30, time:1});
				}
				firstPost = (id+1);
				lastPost = id+noPosts;
			};
			nav.postNav.newerBtn.onRelease = function():Void  {
				if (id<postTotal && id>0) {
					Tweener.addTween(nav.postNav.olderBtn, {_alpha:100, time:1});
					nav.postNav.olderBtn.enabled = true;
					var newPost:Number = id-1;
					var oldPost:Number = id+noPosts-1;
					endPos = (id-1)*(post.bg._height+postSpacing);
					slide(allPosts, allPosts._y, -endPos, postSlideSpeed, "_y", Strong.easeInOut);
					fade(allPosts['post'+newPost], 0, 100, fadeInNewPost, Strong.easeInOut);
					fade(allPosts['post'+oldPost], 100, 0, fadeOutOldPost, Strong.easeOut);
					id--;
				}
button                                                                                                                                                              
				if (id == 0) {
					Tweener.addTween(this, {_filter:glowOut, time:3});
					Tweener.addTween(this, {_alpha:30, time:1});
					this.enabled = false;
				}
text                                                                                                                                                                
				firstPost = (id+1);
				lastPost = id+noPosts;
			};
			nav.postNav.newerBtn.onRollOver = nav.postNav.olderBtn.onRollOver=function ():Void {
				Tweener.addTween(this, {_filter:glowIn, time:3});
			};
			nav.postNav.newerBtn.onRollOut = nav.postNav.olderBtn.onRollOut=nav.postNav.olderBtn.onRollOut=function ():Void {
				Tweener.addTween(this, {_filter:glowOut, time:3});
			};
			postsMask = scope.attachMovie("postsMask", "postsMask", 5);
			postsMask._y = allPosts._y;
			postsMask._x = allPosts._x;
			postsMask._height = (post.bg._height*noPosts)+(postSpacing*noPosts);
			postsMask._width = post._width;
			allPosts.setMask(postsMask);
		} else {
			trace("XML NOT LOADED");
		}
	}
};
buildlargePost = function (targetPost) {
	removeMovieClip(scope.largePost);
	slide(nav, nav._y, nav._y-30, slideOutSpeed, "_y", Strong.easeInOut);
	slide(allPosts, allPosts._x, -postsMask._width*2, slideOutSpeed, "_x", Strong.easeInOut);
	fade(allPosts, 100, 0, fadeOutSpeed, Strong.easeOut);
	largePost = scope.attachMovie("largePost", "largePost", scope.getNextHighestDepth());
	slide(largePost, postsMask._width*2, 0, slideInSpeed, "_x", Strong.easeInOut);
	fade(largePost, 0, 100, fadeInSpeed, Strong.easeInOut);
	largePost.txt.title.text = targetPost.headline;
	largeMask = scope.attachMovie("postsMask", "largeMask", 5000);
	largeMask._height = postsMask._height+40;
	largeMask._width = postsMask._width;
	largeMask._y = -40;
	largePost.setMask(largeMask);
	largePost.txt.description.autoSize = "left";
	largePost.txt.description.html = true;
	largePost.txt.description.htmlText = targetPost.des;
	largePost.txt.description.styleSheet = newsCSS;
	Tweener.addTween(nav.largeNav.backBtn, {_filter:glowOut, time:0});
	nav.largeNav.backBtn.onRelease = function() {
		slide(nav, nav._y, nav._y+30, slideOutSpeed, "_y", Strong.easeInOut);
		slide(largePost, 0, postsMask._width*2, slideOutSpeed, "_x", Strong.easeInOut);
		fade(largePost, largePost._alpha, 0, fadeOutSpeed, Strong.easeOut);
		slide(allPosts, allPosts._x, 0, slideInSpeed, "_x", Strong.easeInOut);
		fade(allPosts, allPosts._alpha, 100, fadeInSpeed, Strong.easeInOut);
	};
	nav.largeNav.backBtn.onRollOver = function():Void  {
and older buttons
		Tweener.addTween(this, {_filter:glowIn, time:3});
	};
	nav.largeNav.backBtn.onRollOut = function():Void  {
		Tweener.addTween(this, {_filter:glowOut, time:3});
	};
};
news.xml
Código:
<?xml version="1.0" encoding="utf-8"?>
<NEWS>	
	
<item>
<title>Atención</title> 
<description>Prueba de acentos á é í y ñ </description>
</item>
</NEWS>
  #2 (permalink)  
Antiguo 16/09/2009, 06:10
Avatar de lvfp  
Fecha de Ingreso: septiembre-2005
Ubicación: España
Mensajes: 337
Antigüedad: 18 años, 7 meses
Puntos: 4
Respuesta: Porque no me toma los acentos

Pon esto antes de tu código:

System.useCodepage=true;

S2
  #3 (permalink)  
Antiguo 16/09/2009, 11:34
Avatar de rec321  
Fecha de Ingreso: mayo-2005
Ubicación: Argentina
Mensajes: 91
Antigüedad: 18 años, 10 meses
Puntos: 1
Respuesta: Porque no me toma los acentos

Cita:
Iniciado por lvfp Ver Mensaje
Pon esto antes de tu código:

System.useCodepage=true;

S2
Si, ya lo realize... pero sin resultados positivos.
  #4 (permalink)  
Antiguo 16/09/2009, 16:25
Avatar de Bandit
Moderador
 
Fecha de Ingreso: julio-2003
Ubicación: Lima - Perú
Mensajes: 16.726
Antigüedad: 20 años, 9 meses
Puntos: 406
Respuesta: Porque no me toma los acentos

Hola rec321:
El código: System.useCodepage=true; solamete funciona en Windows.
Al guardar tu archivo XLM utiliza al Codificación INICODE.

Espero haberte sido de ayuda.
__________________
Bandit.
Si no sabes estudia y si sabes enseña.
http://www.banditwebdesign.com/
  #5 (permalink)  
Antiguo 16/10/2009, 11:33
Avatar de PSChild  
Fecha de Ingreso: diciembre-2001
Ubicación: Google
Mensajes: 762
Antigüedad: 22 años, 4 meses
Puntos: 0
Respuesta: Porque no me toma los acentos

Hola a todos

¿Y guardando un TXT como UTF-8?, con este codigo siguen dando problemas los acentos y las Ñs, ¿alguna idea?

System.useCodepage = true;

txtBox.autoSize = "left";
txtVars = new LoadVars();
txtVars.onLoad = function(contentText) {
txt = this.contentText;
};

txtVars.load("directorio/archivo.txt");
__________________
Salu2
  #6 (permalink)  
Antiguo 16/10/2009, 13:08
Avatar de PSChild  
Fecha de Ingreso: diciembre-2001
Ubicación: Google
Mensajes: 762
Antigüedad: 22 años, 4 meses
Puntos: 0
Respuesta: Porque no me toma los acentos

Solucionando haciendo uso de las fuentes de sistema
__________________
Salu2
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 13:11.