tengo un action scrip para modificar:
Modifique un listbox para que tomara dos idiomas en.xls y es.xls los toma bien pero mi problema es que el espanol(es.xls) no me toma lol acentos.
mi xls lo puse como UTF-8 / Unicode y ISO ademas desde el bloc de notas lo grave como Unicode pero nada no me pone los acentos.
Ahora tambien intente poner System.useCodePage= true; en el primer frame de la animacion pero no me funciona.
estoy seguro que debe ir en el Action Scrip de lenguaje pero no se como insertarlo ya he intentado y no da resultado. Alguien que me pueda orientar giracias
import mx.lang.Locale;
import flash.xml.*;
import mx.controls.Alert;
import flash.utils.getTimer;
class Languages extends MovieClip {
public var currLanguage:String;
static public var isReady = false;
public var idsList:Array;
public var isError = false;
private var recursive = 0;
private var readyText = "";
private var listComboBox:mx.controls.ComboBox;
//public var myAlert:Object;
public function Languages(language:String, listMC:mx.controls.ComboBox) {
idsList = new Array();
this.currLanguage = language;
//this.myAlert = Alert.show("Load Languages...", "Alert");
//this.myAlert.deletePopUp();
trace("Loading Languages currLanguage:"+this.currLanguage);
if (language == "" || language == null) {
//if (Locale.checkXMLStatus() == false)
//{
Locale.setLoadCallback(localeCallback);
loadLanguage(language,listMC);
//}
//else
//{
//isReady = true;
//}
} else {
Locale.setLoadCallback(localeCallback);
loadLanguage(language,listMC);
}
}
private function localeCallback(success:Boolean) {
if (success) {
isReady = true;
trace("Loaded XML file for Language");
_root.setLanguage();
} else {
Alert.show("Language Pack failed to read!","System Information",Alert.OK);
isError = true;
//_root.setLanguageErr();
}
//dispatchEvent(new Event(COMPLETE));
}
public function setLanguageAuto(mc:MovieClip, recursive:Number) {
idsList = new Array();
trace("setLanguageAuto");
setLanguageAuto1(mc,recursive);
}
public function setLanguageAuto1(mc:MovieClip, recursive:Number) {
if (recursive == 0) {
return;
} else {
setLanguageAuto2(mc);
recursive--;
}
/////////////////////////////////////////////////
for (var a in mc) {
setLanguageAuto1(mc[a],recursive);
}
}
public function setLanguageAuto2(mc:MovieClip) {
if (mc._name.substring(0, 4) == "IDS_") {
for (var i = 0; i<idsList.length; i++) {
if (idsList[i] == mc._name) {
//trace("-----------------" + idsList.length + "return:" + mc._name);
return;
}
}
idsList.push(mc._name);
readyText = getText(mc._name);
trace("readyText>>"+mc._name+":"+readyText);
if (readyText == undefined) {
return;
}
if (mc.label != undefined) {
trace("Button:"+mc._name);
return;
}
if (mc.text != undefined) {
trace("Text:"+mc._name);
mc.text = readyText;
return;
}
trace("MovieClip:"+mc._name);
//try
//{
//mc.onEnterFrame = function()
//{
//trace("....................................onEnter Frame:"+mc._name);
//}
//mc.loadMovie(readyText);
var mcLoader:MovieClipLoader = new MovieClipLoader();
var myListener = new Object();
myListener.onLoadInit = function(myMC:MovieClip) {
var myInterval = setInterval(addAlpha,1,myMC);
//trace(myMC._name+">>"+myInterval);
function addAlpha(myMC:MovieClip) {
//trace(myMC._name+">>myInterval.2:"+myInterval);
if (myMC._alpha<100) {
myMC._alpha += 10;
}
else
{
//trace("........................................... ......................................clearInterva l:"+myMC._name+">>"+myInterval);
clearInterval(myInterval);
}
}
};
myListener.onLoadStart = function(myMC:MovieClip) {
myMC._alpha = 0;
//trace("........................................... .............Load-Start:"+myMC._name);
};
myListener.onLoadProgress = function(myMC:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
//myMC._alpha = 0;
myMC._alpha = (bytesLoaded/bytesTotal)*10;
trace("........................................... .............onLoadProgress:"+myMC._alpha);
};
//myListener.onLoadError = function(myMC:MovieClip)
//{
//trace("........................................... .............Load-Error:"+myMC._name);
//}
mcLoader.addListener(myListener);
mcLoader.loadClip(readyText,mc);
//}
//catch (e)
//{
//}
}
}
public function loadedLanguage():String {
return Locale.getDefaultLang();
}
public static function getText(textId:String):String {
if (Languages.isReady) {
var sValue:String;
sValue = Locale.loadString(textId);
//trace("getText result for ID: " + textId + ", value: " + sValue + " time: " + getTimer());
} else {
sValue = "";
}
return sValue;
}
private function loadLanguage(languageParm:String, listMC:mx.controls.ComboBox) {
var sConfigFile:String = "config.xml";
var urlLoader = new XML();
urlLoader.ignoreWhite = true;
urlLoader.load(sConfigFile);
urlLoader.onLoad = function(bool) {
if (bool) {
var lanList:Array = new Array();
var temp = urlLoader.firstChild.childNodes;
for (var i = 0; i<temp.length; i++) {
var obj = new Object();
obj.dialect = temp[i].attributes.dialect;
obj.active = Number(temp[i].attributes.active);
obj.description = temp[i].firstChild.firstChild;
//trace("dialect:" + obj.dialect);
//trace("active:" + obj.active);
//trace("description:" + obj.description);
lanList.push(obj);
//trace("lanList:" + lanList.length);
if (obj.active == 0) {
this.currLanguage = obj.dialect;
}
}
//trace("lanList:"+lanList.length);
var obj:Object;
for (var i = 0; i<lanList.length; i++) {
for (var j = i; j<lanList.length-1; j++) {
if (lanList[j+1].active<lanList[j].active) {
obj = lanList[j];
lanList[j] = lanList[j+1];
lanList[j+1] = obj;
}
}
}
if (listMC != null) {
this.listComboBox = listMC;
//trace("=========================================== =====listMC:"+listMC.length);
listMC.removeAll();
for (var ii = 0; ii<lanList.length; ii++) {
if (lanList[ii].dialect == languageParm) {
listMC.addItem({label:lanList[ii].description, data:lanList[ii].dialect});
}
}
for (var iii = 0; iii<lanList.length; iii++) {
if (lanList[iii].dialect != languageParm) {
listMC.addItem({label:lanList[iii].description, data:lanList[iii].dialect});
}
}
}
//Locale.autoReplace = true;
if (languageParm == null || languageParm == "") {
} else {
this.currLanguage = languageParm;
}
trace("Loading Language File: "+this.currLanguage.toLowerCase()+".xml"+" time: "+getTimer()+" >>>Version:0.2");
Locale.setDefaultLang(this.currLanguage);
Locale.addXMLPath(this.currLanguage,this.currLangu age.toLowerCase()+".xml");
//Locale.initialize();
Locale.loadLanguageXML(this.currLanguage);
} else {
trace("err");
}
};
}
}