I am using the tutorial on the reusable preloader which works great on the first image. But, I recently noticed that it only preloads the first image time it is called, and I never see the preloader again. I am fairly comfortable with AS and I am not a newbie. But, I cant help but feel a little ticked off because I know it is something small that I am just overlooking. I have been searching for an answer for a couple of days nows…
Anyway, here is the link for the preview file.
http://boundless-vision.com/temp/v4_sample.html
Click on portfolio and choose a section and then a gallery piece. NOTE the preloader on the first gallery piece load… but you never see it again…
Which leads me to believe it is something that has to do with my coding - for putting a dynamic path to preload… I have a loop which spits out the buttons and all of the corresponding data.
Anyway, here is what I believe is the affected code
this is in between my chGallery Function - that handles all of my load / parse / display functions… Formatting might have it break, I apologize for that…
[AS][SIZE=2]for (var i = 0; i<chGalleryMC_path.GalleryItem.length; i++) {
// loop through the gallery item var I declared earlier
// this variable is a house for all of the gallery item
// nodes that are located within the chosen gallery xml file
chGalleryMC_Item_path.createEmptyMovieClip(“container”, i);
//
var myItemTitle = chGalleryMC_path.GalleryItem*.firstChild.firstChild.nodeValue;
// declare a local variable to hold temporary name data for text input
chGalleryMC_path.gItem.duplicateMovieClip(“gItem”+i, StartDepth+i);
// duplicate the attatched movie clip in order to loop
// through all of the required gallery items that were
// loaded from the xml file
//
gItem_Temp_MCPATH_Array.push(chGalleryMC_path[“gItem”+i]);
trace(chGalleryMC_path[“gItem”+i]);
//
//
//
chGalleryMC_path[“gItem”+i]._y = startY+(MenuSpacei)+200;
// increment each gallery item down the page
chGalleryMC_path[“gItem”+i]._x = startX;
// set the horizontal space
chGalleryMC_path[“gItem”+i].id = chGalleryMC_path.GalleryItem.attributes.id;
// set.id for the item from the xml node id attribute
chGalleryMC_path[“gItem”+i].itemName.text = myItemTitle;
// display item Title
//chGalleryMC_Item_path.createEmptyMovieClip(myItemTitle, i);
//
chGalleryMC_path[“gItem”+i].itemName_btn.num = i;
//
chGalleryMC_path[“gItem”+i].itemName_btn.path = chGalleryMC_path.GalleryItem*.attributes.path;
// set the button.path the same as the xml loaded gallery item path
// easy load in the release function below
//
chGalleryMC_path[“gItem”+i].itemName_btn.onRollOver = function() {
if (this.num != GalleryItem_Selected) {
this._parent.itemName.setTextFormat(formatText_Bold);
}
};
//
chGalleryMC_path[“gItem”+i].itemName_btn.onRollOut = function() {
if (this.num != GalleryItem_Selected) {
this._parent.itemName.setTextFormat(formatText_NOBold);
}
};
//
//
chGalleryMC_path[“gItem”+i].itemName_btn.onRelease = function() {
// loop generated on release, to load the path of this button
// which is parsed from the xml doc
if (this.num != GalleryItem_Selected) {
// if you already clicked on it, it wont happen again
//
//
gItem_Old = gItem_New;
gItem_New = this.num;
gItemOLDpath = chGalleryMC_path[“gItem”+gItem_Old];
//
//
MenuTitle_SET(gItem_Old, this.num, gItemOLDpath);
//
[COLOR=Red]gItemMCLoader.loadClip(chGalleryMC_path.GbasePath+this.path, chGalleryMC_Item_path.container);[/COLOR]
//loadMovie(chGalleryMC_path.GbasePath+this.path, gIContainer);
trace(chGalleryMC_Item_path[myItemTitle]);
// loads the image located at the chosen gallery path + xml loaded
// gallery base path into the ‘MYWINDOW’ titled window
GalleryItem_Selected = this.num;
// set item selection the the parent id
trace("New: "+gMenuSelection_New);
trace("Old: "+gMenuSelection_Old);
trace("This.num: "+this.num);
trace("This.path: "+this.path);
}
};
}
////////////
//
gItemMCLoader = new MovieClipLoader();
gItemPreload = new Object();
gItemMCLoader.addListener(gItemPreload);
gItemPreload.onLoadStart = function(targetMC) {
gIContainer._alpha = 0;
bar._visible = true;
border._visible = true;
bgDS._visible = true;
gItemPreloaderMC.gItemFadeIn();
};
gItemPreload.onLoadProgress = function(targetMC, lBytes, tBytes) {
bar._width = (lBytes/tBytes)*100;
};
gItemPreload.onLoadComplete = function(targetMC) {
gIContainer.gItemFadeIn();
//gItemPreloaderMC.gItemFadeOut();
border.gItemFadeOut();
bar.gItemFadeOut();
bgDS.gItemFadeOut();
};[/SIZE]
[/AS]
The preload call is made in the dynamically generated onRelease handler for the gallery item button. which loads the image / sets text / etc… etc…
There are four _Shells that i use to load my portfolio images into , each for the sections of my gallery, I dont really want to break this method, only becuase once the image is loaded, it is loaded and there is no real reason for it to have it’s own mc just yet. However, if you could come up with a solution for that also, It would be much appreciated.
Thank you for any responses in advance.