Error Building A PhotoGallery
I have 8 MovieClips on my stage and I am trying to make a photo gallery using this script:
var photo :XML = new XML();
var imgURL :Array = new Array();
var imgCaptions :Array = new Array();
var thumbImg :Array = new Array();
var totImgs : Number = 0;
var imgAtual : Number = 1;
var xPos :Number = Stage.width;
var yPos :Number = Stage.height;
var mclThumb :MovieClipLoader = new MovieClipLoader();
var listenerThumb :Object = new Object();
photo.ignoreWhite = tr开发者_如何转开发ue;
photo.onLoad = function(success) {
if(success) {
var photos :Array = new Array();
photos = this.firstChild.childNodes;
for(var i :Number = 0; i < photos.length; i++) {
imgURL.push(photos[i].attributes.images);
thumbImg.push(photos[i].attributes.thumb);
imgCaptions.push(photos[i].attributes.descricao);
}
totImgs = imgURL.length;
}
}
photo.load("photos.xml");
buildThumb = function() {
for(var i :Number = 1; i <= 8; i++) {
loadMovie(thumbImg[imgAtual],_root["img" + i]);
}
}
buildThumb();
if I test it I will have an error like this:
Error opening URL "file:///C|/Documents%20and%20Settings/Eduardo%20Tavares/My%20Documents/Web%20Sites/site%20dj/images/undefined"
if I remove buildThumb?s function I get no error but It doesnt load anything.
here is my xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<slideshow>
<photo images="foto1.jpg" thumb="thumb1.jpg" descricao="DJ Chambinho fazendo o Gas Total" />
<photo images="foto2.jpg" thumb="thumb2.jpg" descricao="DJ Chambinho fazendo o Gas Total" />
<photo images="foto3.jpg" thumb="thumb3.jpg" descricao="DJ Chambinho fazendo o Gas Total" />
<photo images="foto4.jpg" thumb="thumb4.jpg" descricao="DJ Chambinho fazendo o Gas Total" />
<photo images="foto5.jpg" thumb="thumb5.jpg" descricao="DJ Chambinho fazendo o Gas Total" />
<photo images="foto6.jpg" thumb="thumb6.jpg" descricao="DJ Chambinho fazendo o Gas Total" />
<photo images="foto7.jpg" thumb="thumb7.jpg" descricao="DJ Chambinho fazendo o Gas Total" />
<photo images="foto8.jpg" thumb="thumb8.jpg" descricao="DJ Chambinho fazendo o Gas Total" />
</slideshow>
hmm loadmovie... try using loader in as3.0 instead of loadmovie, i would also suggest try loading an image first for testing in another fla for testing ... loaders script is below ... hoep this helps...
function loadClip(addrs:String):void { var ldr:Loader = new Loader(); ldr.contentLoaderInfo.addEventListener(Event.Complete, loadComplete); var url:String = addrs; var urlReq:URLRequest = new URLRequest(url); ldr.load(urlReq); addChild(ldr); }
function loadComplete(evt:Event):void { trace("movie loaded"); }
精彩评论