Hi,
some one help me how to do Sequentially preload images from XML data. i have a movie clip on stage thats duplicating using array. after its duplicating it need to load multiple images into it. this part is working absolutely fine. my main task is before loads the image i need to set up Sequential preloaded for each dynamic movie clip.
this is where i got stuck:hang::hang: i gone through one example from kirupa forum http://www.kirupa.com/forum/showthread.php?t=282225 trying to implement the same on my fla but i couldn’t achieve that. please take a look at my code
[COLOR=Red]stop();
var xmlImages:XML = new XML();
xmlImages.ignoreWhite = true;
xmlImages.load(“images_test.xml”);
var thumbListener:Object = {};
var thumbLoader:MovieClipLoader = new MovieClipLoader();
var dataObj = new Array();
/var thumbListener:Object = {};
var thumbLoader:MovieClipLoader = new MovieClipLoader();/
xmlImages.onLoad = function(ok) {
if (ok) {//if it loads ok
var images:Array = this.firstChild.childNodes;
var total = images.length;
for (var i = 0; i<total; i++) {
dataObj* = new Object();
dataObj*.img = images*.childNodes[0].firstChild.nodeValue;
dataObj*.title = images*.childNodes[1].firstChild.nodeValue;
dataObj*.desc = images*.childNodes[2].firstChild.nodeValue;
dataObj*.xml = images*.childNodes[3].firstChild.nodeValue;
trace(dataObj*.img)
var mc:MovieClip = _root['item'+i];
if (mc == undefined) {
mc = _root.item0.duplicateMovieClip('item'+i, i);
var initx = _root.item0._x;
var inity = _root.item0._y;
}
mc.btn.i = i;
mc.btn.onRelease = function() {
_root.selgal = dataObj[this.i].xml;
_root.gotoAndStop('gal');
};
/*function loadImages( item:Array ):Void {
if( item.length == 0 )
{
return;
}*/
//duplicating
mc.createEmptyMovieClip("img",0);
var newx = initx+(mc._width+20)*(i%7);
var newy = inity+(mc._height+20)*Math.floor(i/7);
mc._x = newx;
mc._y = newy;
mc.title_txt.text = dataObj*.title;
mc.desc_txt.text = dataObj*.desc;
mc.img.loadMovie(dataObj*.img)
//updates the x position, so the next image stays on side
xpos += 60;
//Progress of whats loading
/*thumbListener.onLoadProgress = function( target:MovieClip, bl:Number, bt:Number):Void{
target._parent.per_txt.text = Math.ceil( ( bl / bt ) * 100) + "% complted";
}
//listeners
thumbListener.onLoadComplete = function( target:MovieClip ):Void {
thumbLoader.removeListener( thumbListener );
loadImages();
}
thumbLoader.addListener( thumbListener );
//thumbLoader.loadClip( dataObj*.img, mc.img);*/
}
//loadImages(dataObj)
} else {
trace("xml could not be loaded. check file name");
}
};[/COLOR]
the code which i blocked out that was the thing i trying to do.
if u guys want my source file or more clarification regarding this please let me know. so that i can upload my files also
Thanks