XML data can't be read by swf file when i publish it



I am trying to read data from a URL http://localhost:15979/default.aspx.The output of the url is :



<?xml version="1.0" encoding="utf-8"?>
<GALLERY>
<IMAGE TITLE="abs">image1.jpg</IMAGE>
<IMAGE TITLE="iron">image2.jpg</IMAGE>
<IMAGE TITLE="shop">image3.jpg</IMAGE>
</GALLERY>


I fetch this values into adobe flash cs with this code:



var myXML:XML = new XML();
var XML_URL:String = "http://localhost:15979/default.aspx";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener(Event.COMPLETE, xmlLoaded);

function xmlLoaded(event:Event):void
{
myXML = XML(myLoader.data);
trace("Data loaded.");
txtname.text=myXML.IMAGE[1].@TITLE;
}


So when i push ctrl +enter the swf file shows the result and every thing works fine ,but when i publish the swf file my XML file can't be read and the myXML.IMAGE[1].@TITLE; doesn't apear on the screen.another problem is when i changed the xml ,the changes don't apply in SWF file.


I changed the xml form to :



<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*" secure="false" />
</cross-domain-policy>
<GALLERY>
<IMAGE TITLE="asas">image1.jpg</IMAGE>
<IMAGE TITLE="ssssss">image2.jpg</IMAGE>
<IMAGE TITLE="shop">image3.jpg</IMAGE>
</GALLERY>


But .fl file throws this error :



TypeError: Error #1088: The markup in the document following the root element must be well-formed.
at _3333333333333333333333_fla::MainTimeline/xmlLoaded()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

No comments:

Post a Comment