Skip to main content
May 4, 2011
Answered

can i load xml file on iphone app?

  • May 4, 2011
  • 2 replies
  • 3555 views

i need load a xml on a ios app .. to display image and sound..

i heard the load functions are not allowed on ios apps

thats true?

This topic has been closed for replies.
Correct answer Joe ... Ward

You can load XML, data, images, etc. You can't load code. So, for example, if you loaded a SWF, you could access embedded assets, but none of the code would work.

2 replies

perbuch
Participant
May 12, 2011

I am working on an iOs application using a XML file - and it runs without any problems.

I store the file in the "data" folder relatively to the application folder:

   xmlReq = new URLRequest("data/"+quiz_XMLfile);
   //creates new XML instance and loads the xml file
   xmlLoader = new URLLoader  ;
   xmlLoader.load(xmlReq);
   //adds an event listener for successful completion of XML load.;
   xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
  private function xmlLoaded(event:Event):void
  {
   var list_XML:XML = new XML(xmlLoader.data);

     ......

     }

July 19, 2011

Yes, this works, but make sure that you include this file in the command line call to adt.

In my case, i'm using a .bat script, but the line looks like:

call "%FLEX_SDK%adt.bat" -package %SIGNING_OPTIONS% iphone/CMAS3MO-%IPATYPE%.ipa application.xml bin/CMAS3MO.swf bin/icons Default.png data/leveldata.xml

Note the last item I added in there. This will effectively copy the data folder with leveldata.xml. Alternatively, I could add the whole data folder by just removing the /leveldata.xml at the end of the command.

Joe ... WardCorrect answer
Participating Frequently
May 4, 2011

You can load XML, data, images, etc. You can't load code. So, for example, if you loaded a SWF, you could access embedded assets, but none of the code would work.