Hey!
Could use some help here. I have an empty fla-file, and this code as the document class:
package {
import flash.display.*;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.ProgressEvent;
public class Photoexperiment extends Sprite {
var xmlLoader:URLLoader = new URLLoader();
var xmlRequest:URLRequest = new URLRequest("photo.xml");
var thumbRoot:String = "http://www.michaelpersson.se/photos/thumbs/";
public function Photoexperiment() {
xmlLoader.load(xmlRequest);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
}
public function xmlLoaded(e:Event):void {
var myXML:XML = new XML(xmlLoader.data);
var thumbAdress:String = thumbRoot + myXML.photo[0].thumb[0];
thumbLoader(thumbAdress);
}
function thumbLoader(thumbAdress:String):void {
var thumbRequest:URLRequest = new URLRequest(thumbAdress);
var thumbLoader:Loader = new Loader();
thumbLoader.load(thumbRequest);
thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumbLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, thumbProgress);
}
function thumbProgress(eventet:ProgressEvent):void {
trace("Downloading file");
}
public function thumbLoaded(e:Event):void {
}
}
}
In the last function thumbLoaded, I want to just add the loaded picture to the stage, but I just get error messages when trying. So can someone help me, and tell me what I suppose to write in thumbLoaded?
Thank you in advance