
22/11/2011, 09:48
|
 | | | Fecha de Ingreso: noviembre-2002 Ubicación: Monclova Coahuila, Méx.
Mensajes: 70
Antigüedad: 22 años, 4 meses Puntos: 0 | |
Flash no lee acentos desde XML Hola, tengo problemas con un XML con texto con acentos y el SFW no los lee.
Su ayuda por favor. Este es el código de mi FLASH
Código:
function loadXML(success) {
if (success) {
xmlNode = this.firstChild;
photoX = [];
photoY = [];
textX = [];
textY = [];
textW = [];
photo = [];
description = [];
total = xmlNode.childNodes.length;
//for loop attributes of each slide
for (i=0; i<total; i++) {
photoX[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
photoY[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
textX[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
textY[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
textW[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
photo[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[6].firstChild.nodeValue;
}
//main slide attributes
delayTime = Number(this.firstChild.attributes.delayTime*1000);
slideshowX = Number(this.firstChild.attributes.slideshowX);
slideshowY = Number(this.firstChild.attributes.slideshowY);
holder_mc._x = Number(slideshowX);
holder_mc._y = Number(slideshowY);
menuVisible = this.firstChild.attributes.menuVisible;
//set slide visible/invisible according to the XML file
if (menuVisible == "no" || menuVisible == "NO") {
slideMenu._visible = false;
} else {
slideMenu._visible = true;
}
menuDirection = this.firstChild.attributes.menuDirection;
menuX = Number(this.firstChild.attributes.menuX);
menuY = Number(this.firstChild.attributes.menuY);
menuSpacing = Number(this.firstChild.attributes.menuSpacing);
//Slideshow controls X and Y positions
slideMenu._x = menuX;
slideMenu._y = menuY;
menuOutEdge = this.firstChild.attributes.menuOutEdgeColor;
menuOutBg = this.firstChild.attributes.menuOutBgColor;
menuOverEdge = this.firstChild.attributes.menuOverEdgeColor;
menuOverBg = this.firstChild.attributes.menuOverBgColor;
//initialize menu
initMenu();
//initialize slide
initSlide();
} else {
trace("Error loading XML");
}
delete xmlData;
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("home.xml");
//----------------------------MAIN FUNCTIONS
//clear the interval in the beginning
//(just incase user clicks on a different menu
//and goes back - start timer over)
function clearListener() {
clearInterval(timeInterval);
}
//initialize slide function
function initSlide() {
//if slide number is undefined or last, set to first
if (n == undefined || n == total) {
n = 0;
//else do nothing
} else {
break;
}
//stop timer
clearInterval(timeInterval);
//update menu
menuColor(n);
//call main slideshow function
buildSlideshow(n);
//update slide number
n++;
}
startX = 0;
startY = 0;
//initialize menu function
function initMenu() {
//for loop for each slide
for (i=0; i<total; i++) {
//add button
slideMenu.attachMovie("menuBtn","a"+i,i);
//assign button
a = slideMenu["a"+i];
//decide whether to have menu in X or Y direction
//according to the XML file
if (menuDirection == "y" || menuDirection == "Y") {
a._y = startY;
} else {
a._x = startX;
}
//add spacer
startX += menuSpacing;
startY += menuSpacing;
//assign menu button its number
a.num = i;
//on press function
a.onPress = function() {
//stop timer
clearInterval(timeInterval);
//initialize slide / set slide number to button clicked
initSlide(n=this.num);
};
//on rollover function
a.onRollOver = function() {
menuRollOver(this.num);
};
//on rollout function
a.onRollOut = function() {
menuRollOut();
};
}
}
//main slideshow function
function buildSlideshow(i) {
//make the holder alpha 0 first (for fade in effect)
holder_mc._alpha = 0;
//align object according to the XML file attributes
holder_mc.photo_mc._x = photoX[i];
holder_mc.photo_mc._y = photoY[i];
holder_mc.description_txt._x = textX[i];
holder_mc.description_txt._y = textY[i];
holder_mc.description_txt._width = textW[i];
//load movie and text from XML file
holder_mc.photo_mc.loadMovie(photo[i]);
holder_mc.description_txt.autoSize = "left";
holder_mc.description_txt.htmlText = description[i];
//loading function
this.onEnterFrame = function() {
preloader_mc._visible = false;
preloader_mc.preloader_txt.text = "";
bLoaded = holder_mc.photo_mc.getBytesLoaded();
bTotal = holder_mc.photo_mc.getBytesTotal();
//if photo has not loaded yet
if (bLoaded<bTotal) {
holder_mc._alpha = 0;
preloader_txt.text = Math.round((bLoaded/bTotal)*100);
//else if photo has loaded
} else if (bLoaded>=bTotal && bLoaded>100 && bTotal>100) {
//fade until alpha is 100
if (holder_mc._alpha<100) {
preloader_txt.text = "";
holder_mc._alpha = holder_mc._alpha+10;
}
//if alpha is 100, start counter
if (holder_mc._alpha>=100) {
timeInterval = setInterval(initSlide, delayTime);
//delete onEnterFrame function when done
delete this.onEnterFrame;
}
}
};
}
//Menu colors according to XML attributes
function menuColor(n) {
//for loop for each menu button
for (i=0; i<total; i++) {
//original edge colors
origEdge = new Color(slideMenu["a"+i].edge);
origEdge.setRGB(menuOutEdge);
//original main colors
origBg = new Color(slideMenu["a"+i].bg);
origBg.setRGB(menuOutBg);
//rollover edge colors
currEdge = new Color(slideMenu["a"+n].edge);
currEdge.setRGB(menuOverEdge);
//rollover main colors
currBg = new Color(slideMenu["a"+n].bg);
currBg.setRGB(menuOverBg);
}
}
Este es mi XML
Código:
<?xml version="1.0" encoding="utf-8"?>
<content
delayTime = "10"
slideshowX = "25"
slideshowY = "25"
menuVisible = "yes"
menuDirection = "x"
menuX = "25"
menuY = "433"
menuSpacing = "18"
menuOutEdgeColor = "0x000000"
menuOutBgColor = "0x333333"
menuOverEdgeColor = "0x000000"
menuOverBgColor = "0x999999">
<slideshow>
<photoX>0</photoX>
<photoY>20</photoY>
<textX>0</textX>
<textY>330</textY>
<textWidth>850</textWidth>
<photo>home_images/1.jpg</photo>
<description>
<![CDATA[Tfdgvdxgdgdfgsdgsdgdsghis herñÑe is an <font color="#FF9900">advanced XML Slideshow</font>, which not only hold <font color="#FF9900">images</font> and <font color="#FF9900">swf files</font>, but also <font color="#FF9900">text</font> with CDATA tags. This text can be customized to any limit html text can be, including color, links, font, alignment, etc.]]>
</description>
</slideshow>
<slideshow>
<photoX>0</photoX>
<photoY>25</photoY>
<textX>0</textX>
<textY>5</textY>
<textWidth>850</textWidth>
<photo>home_images/2.jpg</photo>
<description>
<![CDATA[Both the <font color="#FF9900">text</font> and the <font color="#FF9900">pictures</font> have their own <font color="#FF9900">X</font> and <font color="#FF9900">Y</font> coordinates and can be placed anywhere in any order!]]>
</description>
</slideshow>
<slideshow>
<photoX>0</photoX>
<photoY>0</photoY>
<textX>660</textX>
<textY>0</textY>
<textWidth>200</textWidth>
<photo>home_images/3.jpg</photo>
<description>
<![CDATA[XML File <font color="#FF9900">Main</font> attributes<br>
- Delay Time<br>
- Main X/Y Position<br>
- Holder X/Y Position<br>
- Menu Visible<br>
- menuDirection<br>
- Menu X/Y Position<br>
- Menu Spacing<br>
- Menu Out Colors<br>
- Menu Over Colors]]>
</description>
</slideshow>
<slideshow>
<photoX>0</photoX>
<photoY>0</photoY>
<textX>660</textX>
<textY>0</textY>
<textWidth>200</textWidth>
<photo>home_images/4.jpg</photo>
<description>
<![CDATA[XML File <font color="#FF9900">Slide</font> attributes<br>
- Photo X/Y Positions<br>
- Text X/Y Positions<br>
- Text Width<br>
- Photo Path<br>
- Text Description]]>
</description>
</slideshow>
<slideshow>
<photoX>0</photoX>
<photoY>25</photoY>
<textX>0</textX>
<textY>0</textY>
<textWidth>0</textWidth>
<photo>home_images/swfFile.swf</photo>
<description>
</description>
</slideshow>
</content>
__________________ me falta mucho por aprender |