Jump to content


Photo

Recebendo Dados De Xml


  • Faça o login para participar
1 reply to this topic

#1 Victor Hugo Odo

Victor Hugo Odo

    Doutor

  • Administradores
  • 779 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP
  • Interesses:Compartilhar conhecimentos!

Posted 22/06/2009, 09:53

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
// 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:
<?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>

Fórum WMO - Administrador


#2 Saruman

Saruman

    Veterano

  • Usuários
  • 1112 posts
  • Sexo:Masculino
  • Localidade:São Paulo, SP

Posted 27/06/2009, 15:52

Tente adicionar o comando:
System.useCodepage = true;

import Profile;

var saruman:Profile = new Profile();

saruman.nome = new String("Tiago S. Kaneta");

saruman.localizacao = new Array("São Paulo","SP");




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq