I posted earlier today, but I thought I should show some of my code in case that would help.
If you can help me out with any ideas to try practically or theoretically, I would be grateful. There are more details about the problem in my earlier post of the same title.
This is the list menu file in which the XML generated menu is created. I am only posting the code that I think is important for this problem.
curr_item.onRelease = function(){
Actions[this.action](this.variables);
};
} // end for loop
};
// ----------------< /menu generator >----------------- \\
// ----------------< main menu creator >----------------- \\
CreateMainMenu = function(x, y, depth, menu_xml){
// generate a menu list
GenerateMenu(this, "mainmenu_mc", x, y, depth, menu_xml.firstChild, 1);
};
// ----------------< /main menu creator >----------------- \\
// ----------------< Actions object >----------------- \\
Actions = Object();
Actions.gotoURL = function(urlVar){
getURL(urlVar, "_blank");
};
Actions.message = function(msg){
message_txt.text = msg;
};
Actions.newMenu = function(menuxml){
_level5.xmlData.load(menuxml);
};
// ----------------< /Actions object >----------------- \\
// ----------------< load XML >----------------- \\
menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function(ok){
// create main menu after successful loading of XML
if (ok){
CreateMainMenu(10, 10, 0, this);
message_txt.text = "message area";
}else{
message_txt.text = "error: XML not successfully loaded";
}
};
// load first XML menu
menu_xml.load("xml/designMenu.xml");
// ----------------< /load XML >----------------- \\
for the workPhoto.swf file I need to show a little more code since I can’t figure out exactly where the problem is coming from
// ----------------< Load XML >----------------- \\
function loadXML(loaded) {
removeThumbnails(i);
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
//thumbnails_kill(i);
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("xml/designMaven.xml");
// ----------------< /Load XML >----------------- \\
// ----------------< next and previous >----------------- \\
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
// ----------------< /next and previous >----------------- \\
// ----------------< image loading >----------------- \\
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = false;
if (loaded == filesize) {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
_level0.myWorkMCL.loadClip(image[p], "picture");
desc_txt.text = description[p];
picture_num();
}
} else {
p = 0;
if (loaded == filesize) {
picture._alpha = 0;
_level0.myWorkMCL.loadClip(image[p], "picture");
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
_level0.myWorkMCL.loadClip(image[p], "picture");
desc_txt.text = description[p];
picture_num();
} else {
p = (total-1);
picture._alpha = 0;
_level0.myWorkMCL.loadClip(image[p], "picture");
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
_level0.myWorkMCL.loadClip(image[0], "picture");
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
// ----------------< /image loading >----------------- \\
// ----------------< thumbnail scroller >----------------- \\
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
// ----------------< /thumbnail scroller >----------------- \\
function removeThumbnails(k) {
thumbnail_mc.removeMovieClip("t"+k);
}
// ----------------< thumbnail generation >----------------- \\
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._alpha = 50;
target_mc._x = 2+((target_mc._width+6)*k);
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 100;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 50;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
// ----------------< /thumbnail generation >----------------- \\
----from my ealier post-------
I am currently building a portfolio site and was able to incorporate the kirupa thumbnail gallery in tandem with an externally loaded scrolling XML menu. When you click on an item in the menu, it changes the XML file that is being loaded by the photogallery. Thus the thumbnails and the current image change based on the newly loaded XML doc.
My problem is that the thumbnail images are not completely refreshed. If there are 20 images in XMLdoc1, and 15 images in XMLdoc2, then when I click on XMLdoc2, the first 15 thumbnails change, but the remaining 5 thumbnails from XMLdoc1 stay where they are.
I assume that what is happening is that, because the thumbnails are being placed in new movie clips using getNextHighestDepth, the thumbnails from the newly loaded XML doc simply populate the existing new movies without first refreshing the container mc.
Is there any way to simply add a function that would reset or delete the new movie clips in response to clicking on an externally loaded menu (in another swf) whose current action is simply to call a new XMLdoc?
After that, it would have to regenerate the movie clips based on the new XMLdoc.
My swf tree looks like this:
master.swf //calls everything into itself (as the name implies)
workphoto.swf //the thumbnail gallery is located here (called into level5 of master.swf
listMenu.swf //an XML driven menu with different clients. each item uses an action to call a new XMLdoc into the thumbnail gallery
Actions.newMenu = function(menuxml){
_level5.xmlData.load(menuxml);
};
scrollMenu.swf //listMenu.swf is first called into this swf before being loaded into the master.swf (this is so that the list will scroll)
mainMenu.swf //the mainMenu that is called from the start
to see a sample of what is going on:
http://www.completepicture.com/flash
click on “work” then, using the menu at the bottom, select nicaragua gallery, then select dark city again. You will see that the last few images from nicaragua are appended onto dark city, as dark city has fewer images.
thanks for the help
craig