我构建了一个 Flash 视频播放器,它在导出到 swf 时可以正常工作。但是,当我发布它时(F12)不会加载 xml 文件。结果视频播放器卡在第 2 帧(其中显示了一个带有视频标题的列表,点击标题播放特定视频)。xml 链接不以 .xml 结尾。这是我关于 xml 加载的代码。我尝试将 Flash Player 从 10.2 更改为 9,但我遇到了同样的问题。此外,我认为第 2 帧中的一些按钮不起作用,因为 xml 加载时“卡住”了。(在 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();