Reputation: 1
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.
Upvotes: 0
Views: 70
Reputation: 1
The problem was related to the security settings of Flash Player. I have to add the FDT workspace as a trusted location for developer tests.
Upvotes: 0
Reputation: 8397
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
Upvotes: 0