0
votes

Sorry my poor english

I'm a newbie in ActionScript 3. In FLASH FDT I'm trying to load a xml file using this code:

/* some code */

var questionsURL:URLRequest = new URLRequest('questions.xml');
var loadXML:URLLoader = new URLLoader(questionsURL);
loadXML.addEventListener(Event.COMPLETE, questionsLoaded);

/* more code */

function questionsLoaded(e:Event):void {
    var myText:TextField = new TextField();
    myText.text = "File loaded!";
    addChild(myText);
}

The problem is that the event COMPLETE is never trigged.I never see the TextField with the text "File loaded!".

The project build successfully with no erros in FDT's Console... The xml file is in the same folder that generated swf file I'm using FDT Free.

Thanks for any help.

2
Your code is fine. If your swf was successfully created, try it in a standalone player or in browser.akmozo
Is there a loading error? Add an event listener for IOErrorEvent.IO_ERROR.Aaron Beall

2 Answers

0
votes

Thank you for your help. I find the solution: the problem was related with the security settings of Flash Player. I only have to add the FDT workspace as a trusted location for developer tests.

Sorry for my poor english.

0
votes

I believe, it's because your xml file is never loaded, because of wrong path. Add the error listeners & handlers for them to see the error reason.

loadXML.addEventListener(IOErrorEvent.IO_ERROR, urlLoaderIOErrorHandler );
loadXML.addEventListener(SecurityErrorEvent.SECURITY_ERROR, urlLoaderSecErrorHandler); 
...
/* handlers code */

and add some trace output into your questionsLoaded handler for debug purposes