通过Flash CS 5.5发布时,不要将xml数据加载到列表中

时间:2012-04-09 02:52:31

标签: actionscript-3 flash flash-cs5.5

我构建了一个flash视频播放器,在导出到swf时工作正常。但是当我发布它(F12)时没有加载xml文件。结果,视频播放器停留在第2帧(其中显示带有视频标题的列表并且点击标题播放特定视频)。 xml链接不以.xml结尾。这是关于xml加载的代码。我尝试将Flash Player从10.2更改为9但我遇到了同样的问题。另外,第2帧中的某些按钮无法正常工作,因为xml loading中的“Stuck”。(在swf中导出时工作正常!)

Flash Player版本:10.2,Actionscript:3.0,Flash Professional CS 5.5,fps:24,大小:850px(w)x480px(h)。 FRAME 2的代码。谢谢你的时间。

Security.allowDomain( "*" );
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import fl.controls.Label;


var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
var request:URLRequest = new URLRequest("http://www.olympiacos.org/feeds/videos")
loader.load(request);
loader.addEventListener(Event.COMPLETE, handleComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError)
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError)
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus2)    
function onIOError(evt:IOErrorEvent){
    trace("IOError: "+evt.text);
}
function onHTTPStatus2(evt:HTTPStatusEvent){
    trace("HTTPStatus: "+evt.status);
}
function onSecurityError(evt:SecurityErrorEvent){
    trace("SecurityError: "+evt.text);
}
function handleComplete(event:Event):void
{
try
{
    var rawXML:XML = new XML(event.target.data);
    trace(rawXML);
    var list:XMLList = rawXML.channel.item;
    for (var i:uint=0; i<list.length(); i++)
    {
        t_text.text = list.title.text()[i];
        var data1:String = (list[i].description);
        var srcRegExp:RegExp = /src="(.*?)"/;
        var data2:String = srcRegExp.exec(data1)[1];
        var lwr = data2.search(/1_/i);
        var her = lwr + 10;
        var data3 = data2.substring(lwr,her);
        trace("Entry Id"+i+": "+data3);
        List1.addItem({label:list.title.text()[i],data:data3});
    }
}
catch (e:TypeError)
{
    //Could not convert the data, probavlu because
    //because is not formated correctly
    trace("Could not parse the XML");
    trace(e.message);
}
}

List1.addEventListener(Event.CHANGE, itemChange);
openbtn.addEventListener(MouseEvent.CLICK, opentween);
closebtn.addEventListener(MouseEvent.CLICK, closetween);
closebtn.visible=true;
openbtn.visible=false;

function itemChange(e:Event):void
{
if ( currentFrame == 2)
{
    trace("Video selected");
    gotoAndPlay(3);
}
t_text.text = List1.selectedItem.label;
var videoslcd = List1.selectedItem.data;

}

stop();

1 个答案:

答案 0 :(得分:0)

什么;关于播放安全性的发布设置?应该是“仅限访问网络”

FlashProfessional Publishing Settings