Skip to main content
Inspiring
October 6, 2012
Answered

HELLO NED PLEASE I NEED YOUR HELP IN A URL

  • October 6, 2012
  • 1 reply
  • 1888 views

Hello Ned:

This is othersCafes.swf code which is loaded inside cafes.swf and loaded them in the main, could you please tell me if are correct params inside othersCafes.swf code, I was trying in many ways but doesn't

load the list.

Please see the bold letters only bellow

Thanks in advance.

Regards

Joselyn

var xml:XML;
var url:String = "swfs/todos.xml";
var reqXML:URLRequest = new URLRequest(url);
var loaderXML:URLLoader = new URLLoader();
loaderXML.load(reqXML);
loaderXML.addEventListener(Event.COMPLETE, Cargar);

//////////////////////////////////////FUNCIONES /////////////////////////////

function Cargar(e:Event):void
{
var xml:XML = new XML (e.target.data);
var dp:DataProvider = new DataProvider(xml);
dg.dataProvider = dp;
dp.sortOn("title", Array.CASEINSENSITIVE);
trace(dp.length);
}


function changeHandler(event:Event):void {

    if (cb.selectedIndex > -1) {
   var loaderXML:URLLoader = new URLLoader();

    //////////////////////////////////THIS//////////////////
     loaderXML.load(new URLRequest(cb.selectedLabel.toLowerCase()+"swfs/"+".xml"));
     loaderXML.addEventListener(Event.COMPLETE, populateGrid);
    }
}

function populateGrid(e:Event):void {
//////////////////////////////THIS////////////////////
loaderXML.load(new URLRequest(cb.selectedLabel.toLowerCase()+"swfs/"+".xml"));
loaderXML.removeEventListener(Event.COMPLETE, populateGrid);
var otrosXML:XML = new XML( e.target.data);
//How many items are in the xml file
var otrosLength:int = otrosXML.name.length();
   //This removes all the previously added data in the datagrid.
//cargarLista_mc.gotoAndPlay("click");
dg.removeAll();
//Here we loop through the  nodes in the xml file, and add each as a row to the datagrid
for (var i:int =0; i < otrosLength; i++) {
 
  dg.addItem({Otros: otrosXML.name.@title, Address: otrosXML.name.@address});
}
}

This topic has been closed for replies.
Correct answer Joselyn6

If that first line is the output of the trace, is that the name of a file you are trying to load?

internacionalswfs/+.xml  <- does this look correct to you?  If not, fix it.


Hello Ned:

I did it, just to change the parameter before the combobox method, that's all, it works!!

loaderXML.load(new URLRequest("swfs/"cb.selectedLabel.toLowerCase()+".xml"));

for one beginner, it is very comforting that someone show you the way.

Ned thank you very much for your great help.

I'll be in contact, but maybe no with you ok

Regards

Joselyn

1 reply

Ned Murphy
Legend
October 6, 2012

You shouldn't address your postings to me.  There are others who can help you here as well.

The bold lines you show do not appear to be correct.  The terms you use would seem to be in the incorrect order.  Maybe you can look more closely at your code and to see what I mean and solve it yourself.  Write down what you expect the url to be and compare that to what the code tells it to be, you could even use a trace() to see what the url is if you cannot reason it out from looking at it.

Joselyn6Author
Inspiring
October 6, 2012

Please excuse me Ned, I didn't know,

Just I want to know, which is the correct way to write the params, when I add +"swfs/"+ maybe its grown but is to demostrate what i am trying to do, because

doesn't works me.

loaderXML.load(new URLRequest(cb.selectedLabel.toLowerCase()+"swfs/"+".xml"));

I hope don't bother you

Regards

Joselyn

Have a nice weekend !

Ned Murphy
Legend
October 6, 2012

As I said, try to solve it yourself by reasoning and investigating.  Put the following trace line before those lines  to see if your parameters are providing what you expect them to.  As I said already, I think they not ordered correctly.

trace(cb.selectedLabel.toLowerCase()+"swfs/"+".xml");

loaderXML.load(new URLRequest(cb.selectedLabel.toLowerCase()+"swfs/"+".xml"));