Ok, so the problem I am having is that after i load my thumbnails from my xml file, when i click on that thumbnail I want to be able to load a new window and print out the rest of the info from the xml file for that specific thumbnail. That is where I am stuck, I have the thumbnails listing and when you click one the new window pops up but I can’t seem to get the info for just that specific thumbnail. If anyone can take a look at my code and maybe help out i’d appreciate it.
here is a link to the site also: http://mh-interactive.com/flash/start.html
import TextField.StyleSheet;
var my_styleSheet:StyleSheet = new StyleSheet();
my_styleSheet.onLoad = function(success:Boolean) {
if (success) {
var styles_array:Array = my_styleSheet.getStyleNames();
} else {
trace("Error loading CSS");
}
};
my_styleSheet.load("layout.css");
var shading:MovieClip = createEmptyMovieClip("shading", 10000);
with (shading) {
beginFill(0xFFFFFF, 75);
moveTo(0, 0);
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
lineTo(0, 0);
}
shading.onRelease = function() {
trace("OUCH");
};
shading.onPress = function() {
trace("OUCH");
};
var loader:MovieClip = attachMovie("loadWindow", "loading", 10010);
loader._x = Stage.width/2-loader._width/2;
loader._y = Stage.height/2-loader._height/2;
var myxml:XML = new XML();
myxml.ignoreWhite = true;
myxml.onLoad = function(success) {
if (success) {
finishDoingStuff();
}
};
myxml.load("portfolio.xml");
this.onEnterFrame = function() {
_root.loader.loading_txt.text = "Loading Data...";
var loadedBytes:Number = myxml.getBytesLoaded();
var totalBytes:Number = myxml.getBytesTotal();
var bytes:Number = Math.floor(loadedBytes/1024*1000);
var perLoaded:Number = Math.floor(loadedBytes/totalBytes*100);
_root.loader.loading_perc.text = percLoaded+" %";
_root.loader.loadingBar._width = percLoaded+10;
if (loadedBytes>=totalBytes) {
_root.loader.loading_txt.text = "Data Loaded!";
_root.loader.loadingBar._width = 200;
loader.removeMovieClip();
shading.removeMovieClip();
}
};
function finishDoingStuff() {
if (myxml.loaded) {
home_txt = myxml.firstChild.childNodes[1].firstChild.nodeValue;
about_txt = myxml.firstChild.childNodes[2].firstChild.nodeValue;
services_txt = myxml.firstChild.childNodes[3].firstChild.nodeValue;
contact_txt = myxml.firstChild.childNodes[4].firstChild.nodeValue;
}
this.createTextField("content_txt", getNextHighestDepth(), 309, 87, 380, 429);
content_txt.multiline = true;
content_txt.wordWrap = true;
content_txt.text = home_txt;
content_txt.border = false;
content_txt.styleSheet = my_styleSheet;
content_txt.html = true;
content_txt.selectable = false;
content_txt.htmlText = content_txt.text;
}
function createXMLGallery() {
content_txt.removeTextField();
var gallery:MovieClip = createEmptyMovieClip("gallery", getNextHighestDepth());
gallery._x = 315;
gallery._y = 90;
var numImages = myxml.firstChild.childNodes[5].childNodes.length;
var spacing:Number = 110;
var columns:Number = 3;
for (var i:Number = 0; i<numImages; i++) {
this.thumbHolder = myxml.firstChild.childNodes[5].childNodes*.attributes.thumb;
this.picHolder = myxml.firstChild.childNodes[5].childNodes*.attributes.link;
this.description = myxml.firstChild.childNodes[5].childNodes*.firstChild.nodeValue;
this.thumbViewer = gallery.createEmptyMovieClip("thumb"+i, i);
this.thumbViewer._x = (i%columns)*spacing;
this.thumbViewer._y = Math.floor(i/columns)*spacing;
this.thumbLoader = this.thumbViewer.createEmptyMovieClip("thumbnail_image", getNextHighestDepth());
this.thumbLoader.loadMovie(this.thumbHolder);
this.thumbViewer._alpha = 50;
this.thumbViewer.onRollOver = function() {
this._alpha = 100;
};
this.thumbViewer.onRollOut = function() {
this._alpha = 50;
};
this.thumbViewer.onRelease = function() {
var imageViewer:MovieClip = attachMovie("imageviewer", "imageView", getNextHighestDepth());
imageView._x = Stage.width/2-imageViewer._width/2-10;
imageView._y = Stage.height/2-imageViewer._height/2;
};
}
}
b1.onRelease = function() {
content_txt.text = home_txt;
};
b2.onRelease = function() {
content_txt.text = about_txt;
};
b3.onRelease = function() {
createXMLGallery();
};
b4.onRelease = function() {
content_txt.text = services_txt;
};
b5.onRelease = function() {
content_txt.text = contact_txt;
};
stop();