I build a flash video player which works fine when exported to swf. However when I publish it (F12) does not loading the xml file. As a result video player stuck to frame 2 (where presented a List with video titles and with click on title plays the specific video). The xml link does not ends to .xml. Here is my code about xml loading. I try to change the Flash Player from 10.2 to 9 but I have the same problem.In addition some buttons in frame 2 does not works I suppose because of "Stuck" from xml loading.( Work fine when exported in swf!)
Flash Player version: 10.2, Actionscript:3.0, Flash Professional CS 5.5, fps:24, size: 850px(w)x480px(h). Code from FRAME 2 . Thanks for your time guys.
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();