来自as3中的xml的图像

时间:2014-06-18 15:48:47

标签: xml actionscript-3

我很高兴as3如果我没有使用正确的条款,请原谅我。我有一个xml文件,我定期用twitter信息更新。我能够将xml文件中的动态文本加载得很好,但我不知道如何将图像加载到舞台上。 xml具有列出的图像文件名。图片保存到C:\ twitter。有人能帮助我吗?

代码:

import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;

var xmlData:XML = new XML();
var theURL_ur:URLRequest = new URLRequest("streamcontrol.xml");
var loader_ul:URLLoader = new URLLoader(theURL_ur);
loader_ul.addEventListener("complete", fileLoaded);

function fileLoaded(e:Event):void
{
xmlData = XML(loader_ul.data);
picFileName.load = xmlData.twitter.picFileName;
username.text = xmlData.twitter.username;
twittertext.text = xmlData.twitter.text;

}

这是XML文件

!DOCTYPE StreamControl>
<items>
 <timestamp>1402974867</timestamp>
 <Ap1>Bankai213</Ap1>
 <Ap2>PrinceMurphy</Ap2>
 <Bp1>D3v</Bp1>
 <Bp2>GPTV|Iori Sei / Reiji</Bp2>
 <Cp1>Hamill</Cp1>
 <Cp2>Stonehead</Cp2>
 <Dp1>Eat My Jolly Hotdog</Dp1>
 <Dp2>Ricardo Fellini</Dp2>
 <Ep1>JAV|Krimpai</Ep1>
 <Ep2>HashTag2dLifeTNK1</Ep2>
 <Fp1>JAV|Krimpai</Fp1>
 <Fp2>BTAS|Conroy</Fp2>
 <Gp1>Mark Hamill</Gp1>
 <Gp2>KR|Swordy</Gp2>
 <cTitle1>Current Topic</cTitle1>
 <cTitle2>Spurs/Heat</cTitle2>
 <mText1></mText1>
 <mText2></mText2>
 <mText3></mText3>
 <mText5></mText5>
 <pCountry1>PH</pCountry1>
 <pCountry2>US</pCountry2>
 <pName1>Dru</pName1>
 <pName2>PrinceMurphy</pName2>
 <pScore1>0</pScore1>
 <pScore2>0</pScore2>
<twitter>
 <username>mashable</username>
 <twittername>Mashable</twittername>
 <text>Listen to these 23 songs to feed your rebellious side. 
#MusicMonday        http://t.co/xl4wPDHIx1 http://t.co/4YRSdqyzYR</text>
 <created>Tue Jun 17 03:01:29 +0000 2014</created>
 <picFileName>5c348fee8afbcefa1978004a864a51ce.png</picFileName>
</twitter>
<game>Vampire Savior</game>
</items>

0 个答案:

没有答案