The problem is the scroll isn’t working properly.
You will see what I mean if you click here
When I export for flash player 9 instead of 6 I also have a couple of problems.
- the first image doesn’t load.
- the image loads before the border changes size. (Look at the last image and any of the other images and you will see what I mean)
Here’s the code
var spacing = 10;
var thumbspace = 65;
containerMC._alpha = 0;
var pArray = new Array();
var tArray = new Array();
var nArray = new Array();
MovieClip.prototype.loadPic = function(pic) {
_root.containerMC._alpha = 0;
this.loadMovie(pArray[pic]);
//tnborder.loadMovie(nArray[pic]);
this._parent.onEnterFrame = function() {
var total = _root.containerMC.getBytesTotal();
var loaded = _root.containerMC.getBytesLoaded();
bar._visible = 1;
per = Math.round((loaded/total)*100);
if (total != 0 && Math.round(loaded/total) == 1 && _root.containerMC._width != 0) {
var w = _root.containerMC._width+spacing, h = _root.containerMC._height+spacing;
_root.border.resizeMe(w, h, pic);
_root.bar._visible = 0;
_root.loadText._visible = 0;
delete this._parent.onEnterFrame;
} else {
_root.bar._width = per;
_root.loadText.text = per;
}
};
};
MovieClip.prototype.resizeMe = function(w, h, pic) {
var speed = 5;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height +=(h-this._height)/speed;
picinfo.info.text = tArray[pic];
if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
this._width = w;
this._height = h;
containerMC._x = this._x-this._width/2+spacing/2;
containerMC._y = this._y-this._height/2+spacing/2;
containerMC._alpha = 100;
delete this.onEnterFrame;
}
};
};
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
if (success) {
var gallery = this.firstChild;
for ( var i = 0; i<gallery.childNodes.length; i++) {
tArray.push(gallery.childNodes*.attributes.title);
pArray.push(gallery.childNodes*.attributes.source);
thumbHolder = tnborder.createEmptyMovieClip("thumb"+i, i);
thumbHolder._x = i*thumbspace;
thumbLoader = thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
thumbLoader.loadMovie(gallery.childNodes*.attributes.thumbnail);
thumbHolder._index = i;
//Makes thumb transparent//
thumbHolder.onRollOver = function() {
this._alpha = 40;
};
thumbHolder.onRollOut = function() {
this._alpha = 100;
};
//Click to change image//
thumbHolder.onRelease = function() {
_root.containerMC.loadPic(this._index);
_root.picinfo.text = tArray[this._index];
};
//nArray.push(gallery.childNodes*.attributes.thumbnail);
}
// load first picture
_root.containerMC.loadpic(0);
} else {
picinfo.info.text= "Error!";
}
};
//containerMC.onEnterFrame = function (firstimage) {
//if (loaded == total) {
//_root.containerMC.loadpic(0);
//_root.containerMC._alpha = 0;
//}
// }
//Set mask
tnborder.setMask(mask_mc);
//makes thumb scroll
tnborder.onRollOver = panelOver;
function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
}
var b = Bound_MC.getBounds(_root);
function scrollPanel() {
if (_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
this.onRollOver = panelOver;
delete this.onEnterFrame;
}
//if (tnborder._x>=0) {
//tnborder._x = 0;
//}
if (_root.tnborder._x<=_root.mask_mc._width-_root.tnborder._width) {
_root.tnborder._x = _root.mask_mc._width-_root.tnborder._width;
}
var xdist = _xmouse-(_root.Bound_MC._width);
_root.tnborder._x +=-xdist/50;
}
gallery_xml.load("gallery.xml");
Thanks
vxd