..:: MX Studio Fóruns ::..: Problemas ao importar XML - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




ATENÇÃO

Para evitar posts desnecessários e que não influam para o andamento e desenvolvimento do fórum, clique aqui e leia todas as regras.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problemas ao importar XML Caracteres especiais.

#1 User is offline   kilik 

  • Group: Membros
  • Posts: 347
  • Joined: 02-March 07

  Posted 22 June 2009 - 10:56 AM

Olá,

Estou com um probleminha, tenho um slideshow que recebe imagens, e textos atravéz de um XML, mas ele não está interpretando caracteres especiais. Tentei codificalos tipo "á", mas ainda assim não são reconhecidos. alguém sabe o que eu poderia fazer?

Código AS 2
CÓDIGO
// XML Image Slide
// Created by Burhan Uddin
// Date: 10/11/2007
// Version.: 1.0
// (c) http://dscripts.awardspace.com

// URL to the source xml
var xml_src     = 'photo_slider.xml';
// Seconds to show each slide
var slide_delay = 10;
// Frame rate of this flash file
var frame_rate  = 25;
// Sliding. Set to 1 to start auto sliding, to turn it off set 0
var sliding     = 1;
// amount of fading speed 1-100
var fade        = 30;

var sec_count = 0;

p = 0;
b = 0;

function loadXML(loaded)
{
    if (loaded)
    {
        xmlNode = this.firstChild;
        image = [];
        description = [];
        total = xmlNode.childNodes.length;
        for (i=0; i<total; i++)
        {
            image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
            titulo[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
            description[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
            }
        showImage();
    }
    else
    {
        content = "Failed to load XML File";
    }
}

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(xml_src);


listen = new Object();
listen.onKeyDown = function()
{
    if (Key.getCode() == Key.LEFT)
    {
        if(picture._alpha >= 100)
            prevImage();
    }
    else if (Key.getCode() == Key.RIGHT)
    {    
        if(picture._alpha >= 100)
            nextImage();
    }
}

Key.addListener(listen);
PREV.onRelease = function()
{
    if(picture._alpha >= 100)
        prevImage();
}
NEXT.onRelease = function()
{
    if(picture._alpha >= 100)
        nextImage();
};



function reset_timer()
{
    sec_count = 0;
    this.timer.gotoAndPlay(1);
    this.slider.gotoAndPlay(1);
}

function showImage()
{
    if (loaded == filesize)
    {
        picture._alpha = 0;
        picture.loadMovie(image[p], 1);
        this.titulo.txt = titulo[p];
        this.cap.txt = description[p];
        hover.pic.txt = p+1+" / "+total;
        this.hover.play();
        reset_timer();
    }
}

function nextImage()
{    
    if (p<total-1)
        p++;
    else
        p = 0;
    showImage();
}
function prevImage()
{
    if(p>0)
        p--;
    else
        p = total-1;
    showImage();
}

this.onEnterFrame = function()
{
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    if (loaded != filesize)
    {
        preloader.bar._xscale = 100*loaded/filesize;
        if (preloader._alpha<100)
            preloader._alpha += fade;
            
        if(cap._alpha > 0)
            cap._alpha += fade;
    }
    else
    {
        if (picture._alpha<100)
            picture._alpha += fade;
            
        if(preloader._alpha > 0)
            preloader._alpha -= fade;
            
        
        if( picture._alpha >= 100 )
        {
            if(b == 0)
            {
                picture_bg.loadMovie(image[p], 1);
                b = 1;
            }            
        }
        else
            b = 0;
    }
}


Esse é o XML:
CÓDIGO
<?xml version="1.0" encoding="UTF-8" charset="iso-8859-1" standalone="yes"?>
<images>
    <pic>
        <image>album/batmanark.png</image>
    <titulo>Batman Arkham Asylum</titulo>
        <caption>é Encarnando o Homem-Morcego, enfrente o Coringa e outros vilões no sanatório de Gotham City.</caption>
    </pic>
</images>

0

#2 User is offline   RONYTORRES 

  • Group: Moderadores
  • Posts: 385
  • Joined: 07-December 06

Posted 22 June 2009 - 03:18 PM

Vá neste trecho da função "showImage" e habilita a propriedade html:

CÓDIGO

function showImage() {
    if (loaded == filesize) {
        picture._alpha = 0;
        picture.loadMovie(image[p], 1);

        this.titulo.html = true;
        this.titulo.htmlText = titulo[p];
        this.cap.html = true;
        this.cap.htmlText = description[p];

        hover.pic.txt = p+1+" / "+total;
        this.hover.play();
        reset_timer();
    }
}


Acho que deve funcionar, lembrando que não testei.

Qualquer dúvida, posta aí.
0

#3 User is offline   Rodrigo Pixel 

  • Group: Moderadores
  • Posts: 1279
  • Joined: 07-May 07

Posted 22 June 2009 - 04:07 PM

Complementando...

Coloque isso no começo do seu código:
CÓDIGO
System.useCodepage = true;


Abraço.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)