Skip to main content
Known Participant
December 7, 2016
Question

[Flash CS5 Air for Android App] Doesn't load external XML on smartphone

  • December 7, 2016
  • 1 reply
  • 333 views

Hello!

I am new in this forum!

Recently i have been developping an android application that loads an external XML.

In "Air Debug Launcher (Mobile)" it runs well, but in my smartphone it doesn't work as it should.

I discovered that the app (in my smartphone) doesn't load the XML.

I didn't get if the xml doesn't exist in .apk or it just cant find it.

Can you help me discovering what is going on?

var swf: Stage = ecra_container.stage;

swf.scaleMode = StageScaleMode.NO_BORDER;

var caminho: String;

var myXML: XML = new XML();

var XML_URL: String = "lista.xml";

var myXMLURL: URLRequest = new URLRequest(XML_URL);

var myLoader: URLLoader = new URLLoader(myXMLURL);

var ldr: Loader = new Loader();

myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(event: Event): void {

  //texto.text = "dentro da função";

  myXML = XML(event.target.data);

  for (var i: uint = 0; i < myXML.movie.length(); i++) {

  lista.addItem({

  label: myXML.movie.nome.text(),

  data: myXML.movie.link.text()

  });

  lista.addEventListener(Event.CHANGE, reproduzir);

  }

}

addChild(lista);

function reproduzir(event: Event): void {

  caminho = event.target.selectedItem.data;

  trace(caminho);

  var Request: URLRequest = new URLRequest(caminho);

  ldr.load(Request);

  ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swf);

  function swf(event: Event): void {

  var proporcoes: uint = 2.259;

  var t_x = ldr.width;

  var t_y = ldr.height;

  ldr.width /= proporcoes;

  ldr.height /= proporcoes;

  ecra_container.addChild(ldr);

  }

}

Thank you very much!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 7, 2016

you must add the lista.xml to your 'included files'.

Known Participant
December 8, 2016

Thank you very much!

I spent two entire days trying to reach the soluction!

Thank you!