[font=Trebuchet MS]Hi I was wondering if there would be someone out there kind enough to help out little cute me?
I would love it if someone could either comment this code for me or explain it for me bit by bit :beam:
It would be ever so nice of you if you could help me out here… and I know you guys out there are nice blokes so please dont let my hopes down :hugegrin: [size=1][color=SlateGray]*batters eyelashes [/color][/size](<— seems to work a treat with you guys)
Here is the code I need explained (it is a version of Senoculars Portfolio)…
I get the jist of it but I really want and need to be able to understand this code 100%
var thumb_spacing = 40;
var columns = 10; //change this one to the number of thumbs you want to have in a row
// load variables object to handle loading of text
var description_lv = new LoadVars();
description_lv.onData = function(raw_text) {
description_txt.text = raw_text;
};
function GeneratePortfolio(portfolio_xml) {
var portfolioPictures = portfolio_xml.firstChild.childNodes;
for (var i = 0; i<portfolioPictures.length; i++) {
var currentPicture = portfolioPictures*;
var currentThumb_mc = menu_mc.createEmptyMovieClip("thumbnail_mc"+i, i);
currentThumb_mc._x = (i%columns)*thumb_spacing;
currentThumb_mc._y = Math.floor(i/columns)*thumb_spacing;
currentThumb_mc.createEmptyMovieClip("thumb_container", 0);
currentThumb_mc.thumb_container.loadMovie(currentPicture.attributes.thumb);
currentThumb_mc.title = currentPicture.attributes.title;
currentThumb_mc.image = currentPicture.attributes.image;
currentThumb_mc.description = currentPicture.attributes.description;
currentThumb_mc.onRollOver = currentThumb_mc.onDragOver=function () {
info_txt.text = this.title;
};
currentThumb_mc.onRollOut = currentThumb_mc.onDragOut=function () {
info_txt.text = "";
};
currentThumb_mc.onRelease = function() {
preload(this.image);
description_lv.load(this.description);
};
}
}
function preload(clip) {
image_mc.loadMovie(clip);
var temp = this.createEmptyMovieClip("tmp", 999);
temp.onEnterFrame = function() {
var w = image_mc.getBytesLoaded();
var t = image_mc.getBytesTotal();
var per = Math.round((w/t)*100);
total_txt.text = "loading "+Math.round(t/1024)+" kB";
loaded_txt.text = Math.round(w/1024)+" kB loaded";
loadBar._xscale = per;
if (w == t && image_mc._width>0 && image_mc._height>0) {
total_txt.text = loaded_txt.text="";
loadBar._xscale = 0;
delete this.onEnterFrame;
}
};
}
// xml object for xml content (defines sources for selections)
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success) {
if (success) {
GeneratePortfolio(this);
} else {
trace("Error loading XML file");
}
// no success? trace error (wont be seen on web)
};
// load
portfolio_xml.load("portfolio.xml");
Cheers guys :love:
[color=MediumTurquoise]/mette[/color]
[/font]