Guys, I am trying to make a photo gallery, XML driven. Thumbs get placed dynamically and upon click you get to see the full image.
This is how it goes -
- Load xml on first frame.
- Pull movie clip ‘thumbs_mc’ from the library and line it up dynamically. The code on first frame also loads a thumbsize jpg into the thumbs_mc movieclip.
[size=1][color=darkred]-- Works fine till this stage --[/color][/size] - Inside the movie clip I have onRollOver code with an animation for image_mc.[size=2][color=black]As soon as i rollOver, the image disappears. Because of a new instance in animation. The new instance is also named image_mc.[/color][/size]
- I also want to load an image but the xml loaded in the first frame just looses all values. and tracing any node gives Undefined.
- Cant flash load external ‘gifs’…?
Code on first frame -
stop();
//*/
var newThumb:MovieClip;
var spacing_V:Number = 40;
var spacing_H:Number = 40;
////////////////////////////////////
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
thumb = [];
description = [];
total = xmlNode.childNodes.length;
newSet = _parent.referer.createEmptyMovieClip('newSet', 'newSet', this.getNextHighestDepth());
newSet._x = 80;
newSet._y = 80;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
thumb* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
newSet.attachMovie('thumbs_mc', "thumbs_mc"+i, i);
var newThumb = "thumbs_mc"+i;
trace(newThumb);
newSet[newThumb]._x = (i%6)*spacing_H;
newSet[newThumb]._y = Math.floor(i/6)*spacing_V+100;
//trace("imagename = "+thumb*);
newSet[newThumb].image_mc.loadMovie(thumb*, this.getNextHighestDepth());
}
//button_layout();
//trace(total);
} else {
trace("file not loaded!");
}
}
////////////////////////////////////
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
Code inside Movie clip -
stop();
this.onRollOver = function()
{
play();
}
this.onRollOut = function()
{
gotoAndStop(1);
}
this.onRelease = function()
{
_root.galleryImage = "scrapbook/coors01";
_root.imageMC.gotoAndPlay("close");
gotoAndPlay("down");
}
Thanks for reading this post. Any help would be appreciated.
Surdzz