Maciej
Szczepański
www, marketing,
reklama
Temat: ładowanie XML do flasha
Witam, mam nastepujacy problem, chciałbym załadowac do flasha XML, a nastepnie przy pomocy petli for wyswietli tylko wybrane tagi.AS3:
var ladujXML:URLLoader = new URLLoader();
var adresXML:URLRequest = new URLRequest("rss.xml");
ladujXML.load(adresXML);
ladujXML.addEventListener(Event.COMPLETE, daneOK);
function daneOK(zdarzenie:Event): void{
dane = new XML(ladujXML.data);
for each (var dane:XML in dane.item) {
trace (dane);
}
}
Plik XML:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
>
<channel>
<title>TYTUL GLOWNY</title>
<atom:link href="link" rel="self" type="application/rss+xml" />
<link>LINK</link>
<description>OPIS</description>
<lastBuildDate>Sat, 27 Mar 2010 18:00:23 +0000</lastBuildDate>
<generator>http://wordpress.org/?v=2.8.4</generator>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<item>
<title>Tytul 1</title>
<link>Link 1</link>
<comments>Komentarz</comments>
<pubDate>2010-04-01 14:56:18</pubDate>
<dc:creator>Autor</dc:creator>
<category><![CDATA[Komentarze Swiat]]></category>
<guid isPermaLink="false">Link 1.1</guid>
<description><![CDATA[Opis]]></description>
<content:encoded><![CDATA[Opis]]></content:encoded>
<wfw:commentRss>Link 1.2</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
<item>
<title>Tytul 2</title>
<link>Link 2</link>
<comments>Komentarz</comments>
<pubDate>2010-04-01 14:56:18</pubDate>
<dc:creator>Autor</dc:creator>
<category><![CDATA[Komentarze Swiat]]></category>
<guid isPermaLink="false">Link 2.1</guid>
<description><![CDATA[Opis]]></description>
<content:encoded><![CDATA[Opis]]></content:encoded>
<wfw:commentRss>Link 2.2</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
Na tym etapie probuje wyswietlic wszystko, ale nie moge dojsc gdzie mam blad w AS.
Prosze o pomoc.