Skip navigation
Currently Being Moderated

XML Error

Jun 12, 2012 10:18 AM

i trying to play swf file from another swf  through XML path. if i use trace showing path correctly.

But if i added in URLRequest i facing error.

 

My Code


var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("flashfiles.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
 
function processXML(e:Event):void
{
          myXML = new XML(e.target.data);
          trace(myXML.FILE[0]);
          bLdr.load(new URLRequest(myXML.FILE[0]));
}
 
 
var bLdr:URLLoader = new URLLoader();                    // line 24
bLdr.addEventListener(Event.COMPLETE, onLoadInit);
bLdr.dataFormat = URLLoaderDataFormat.BINARY;

 

XML File


<?xml version="1.0" encoding="utf-8"?>
<FILES>
<FILE PATH="player">http://www.mywebsite.com/test/ondemand_player.swf</FILE>
</FILES>

 

Output Error:

http://www.mywebsite.com/test/ondemand_player.swf

http://www.mywebsite.com/test/ondemand_player.swf

http://www.mywebsite.com/test/ondemand_player.swf

http://www.mywebsite.com/test/ondemand_player.swf

http://www.mywebsite.com/test/ondemand_player.swf

http://www.mywebsite.com/test/ondemand_player.swf

http://www.mywebsite.com/test/ondemand_player.swf

http://www.mywebsite.com/test/ondemand_player.swf

http://www.mywebsite.com/test/ondemand_player.swf

 

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: http://www.mywebsite.com/test/ondemand_player.swf

          at ondemand_player_fla::MainTimeline/frame1()[ondemand_player_fla.MainTi meline::frame1:24]

 
Replies
  • Currently Being Moderated
    Jun 12, 2012 11:02 AM   in reply to Venkom

    Are all files in the same domain?

    perhaps you need cross domain policies

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 13, 2012 12:17 AM   in reply to Venkom

    When you want to load the swf after performing some action or directly

     

    to load the url you can you navigateToURL it will load

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 13, 2012 4:32 AM   in reply to Venkom

    Hi,

     

    I think your code is correct, the only thing you need is to allow domains in your cross domain policy .

    use the below code in 1st frame of your fla, it should work.

     

    import flash.system.Security;

     

    Security.allowDomain("*");

    Security.allowInsecureDomain("*");

     

    Vipul

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 13, 2012 11:20 PM   in reply to Venkom

    Hi,

     

    When i compiled your code i have not got any error, can you please try this :

     

    package

    {

              import flash.display.MovieClip;

              import flash.net.URLLoader;

              import flash.events.Event;

              import flash.net.URLRequest;

              import flash.net.URLLoaderDataFormat;

     

              public class ondemand_player extends MovieClip

              {

                        var myXML:XML;

                        var myLoader:URLLoader = new URLLoader();

                        var bLdr:URLLoader = new URLLoader();

     

                        function ondemand_player():void

                        {

                                  myLoader.load(new URLRequest("data.xml"));

                                  myLoader.addEventListener(Event.COMPLETE, processXML);

     

                                  bLdr.addEventListener(Event.COMPLETE, onLoadInit);

                                  bLdr.dataFormat = URLLoaderDataFormat.BINARY;

                        }

                        

                        function processXML(e:Event):void

                        {

                                  myXML = new XML(e.target.data);

                                  trace(myXML.FILE[0]);

                                  bLdr.load(new URLRequest(myXML.FILE[0]));

                        }

     

                        function onLoadInit(e:Event):void

                        {

     

                        }

              }

    }

     

     

    And data.xml is :

     

    <?xml version="1.0" encoding="utf-8" ?>

    <data>

              <FILE PATH="player">http://www.mywebsite.com/test/ondemand_player.swf</FILE>

    </data>

     

    Regards,

    Vipul

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points