Ok, I’ve been going through the code in this tutorial:
http://www.flash-db.com/Tutorials/loadingAS3/loadingData.php?page=1
I’ve got some issue with the code below. Check out the problems in the comments.
This is the output of the banner.php script(wrapped for readability):
image0=http://www.listinventory.com/file_uploads/banners/banner.swf&
image1=http://www.listinventory.com/file_uploads/banners/crimp.swf&cant=2
import fl.containers.UILoader;
var ar_movies:Array = new Array();
var movieIndex=0;
//Create the URLLoader instance
var xLoader:URLLoader = new URLLoader();
var aLoader:UILoader = new UILoader;
addChild(aLoader);
aLoader.scaleContent = false;
aLoader.height = 90;
aLoader.width = 715;
//the data will come as URL-encoded variables
xLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
//Load using an URLRequest
xLoader.load(new URLRequest("http://www.listinventory.com/libs/class/banner.php"));
//onLoad handler listener
xLoader.addEventListener(Event.COMPLETE, onDataLoad);
//add a listener for the complete event
function onDataLoad(evt:Event){
for(var i:uint=0; i<evt.target.data.cant; i++){
// Push the values into the arrays
this.ar_movies.push(evt.target.data["image"+i]);
// What is this loader for?
// var loader:Loader = new Loader()
// loader.load(new URLRequest(evt.target.data["links"+i]))
}
// Now load the first movie into the loader
aLoader.source = ar_movies[movieIndex]; // No movie shows!!!
}
// Now, how do I setup an event listener to wait for the
// movie to finish and then load the next one in the UILoader?
function onMovieFinish(evt:Event) {
//aLoader.source = ar_movies[movieIndex];
//if (movieIndex >= ar_movies.length) {
// movieIndex = 0;
//}
}