我的舞台上有8个MovieClip,我正在尝试使用这个脚本制作照片库:
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 = true;
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();
如果我测试它,我会有这样的错误:
错误打开网址“file:/// C | / Documents%20和%20Settings / Eduardo%20Tavares / My%20Documents / Web%20Sites / site%20dj / images / undefined”
如果我删除buildThumb的函数我没有错误,但它没有加载任何东西。
这是我的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>
答案 0 :(得分:0)
hmm loadmovie ...尝试在as3.0中使用加载程序而不是loadmovie,我还建议尝试首先加载图像以便在另一个fla中进行测试以进行测试...加载程序脚本如下...这有助于...
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 { 跟踪(“电影加载”); }