Hi I’ve been working on this photogallery for my site and i am a beginner level flash lover and i can’t really figure it out how to do it.
I am trying to add to the flash movie a prev and next button and the gallery is made out of an xml gallery code that load externally the pics and the thumbs are loaded into a strip and the pics are loaded with the dinamic resize effetct…i can’t figure it out…here is the code:
spacing = 10;
containerMC._alpha = 0;
pArray = new Array();
pictArray = new Array();
MovieClip.prototype.loadPic = function(pic) {
this._alpha = 0;
this.loadMovie(pArray[pic]);
this._parent.onEnterFrame = function() {
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
bar._visible = 1;
per = Math.round((l/t)100);
if (t != 0 && Math.round(l/t) == 1 && containerMC._width != 0) {
var w = containerMC._width+spacing, h = containerMC._height+spacing;
border.resizeMe(w, h);
bar._visible = 0;
delete this.onEnterFrame;
} else {
bar._width = per;
}
};
};
MovieClip.prototype.resizeMe = function(w, h, pic) {
var speed = 3;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
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;
}
};
};
my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success) {
if (success) {
for (var i = 0; i<this.firstChild.childNodes.length; i++) {
pictArray.push(this.firstChild.childNodes.attributes.thumb);
pArray.push(this.firstChild.childNodes*.attributes.image);
}
}
delay = setInterval(makeMenu, 100);
};
my_xml.load(“gallery2.xml”);
var menu = this.createEmptyMovieClip(“menu_tot”, 99);
menu.setMask(mask);
var sub_menu = menu.createEmptyMovieClip(“menu”, 100);
var p = 0;
var q = 0;
var loadper = 0;
function makeMenu() {
clearInterval(delay);
var item = sub_menu.createEmptyMovieClip(“pic”+q, q);
item.loadMovie(pictArray[p]);
var temp = _parent.createEmptyMovieClip(“tmp”, 9999+q);
temp.onEnterFrame = function() {
var tot = item.getBytesTotal();
var loa = item.getBytesLoaded();
var per = Math.round(((loa/tot)100)/(pictArray.length2));
loadBar._xscale = loadper+per;
if (tot == loa && tot>4) {
item.id = p;
loadper += per;
if (q>0) {
item._x = sub_menu[“pic”+(q-1)]._x+sub_menu[“pic”+(q-1)]._width;
} else {
item._x = 0;
}
item.onRelease = function() {
containerMC.loadPic(this.id);
};
nextItem();
delete this.onEnterFrame;
}
};
}
var amount = pictArray.length-1;
function nextItem() {
if (q<((pictArray.length2)-1)) {
q++;
if (p<(pictArray.length-1)) {
p++;
makeMenu();
} else {
p = 0;
makeMenu();
}
} else {
activateMenu();
}
}
var center = Stage.width/2;
var speed = .05;
function activateMenu() {
menu.onEnterFrame = function() {
var distance = _root._xmouse-center;
if (mask.hitTest(_root._xmouse, _root._ymouse)) {
this._x += (distancespeed);
if (this._x<-sub_menu._width/2) {
this._x = 0;
}
if (this._x>0) {
this._x = -sub_menu._width/2;
}
}
};
}
Thanks anybody that can help me and explain to me where to put the code and how should i call these functions.
Also ,if anybody knows, i wanna know if is possible to make a gallery that is made out of an infinite thumb strip and everytime i click on one it will load the resized effetct pic right into the infinite strip gallery …with the easing effect.
I don’t know if is possible.
Another question about the code i posted is that i wanna stop the infinite thumb action everytime i click on a thum pic , and when i roll over another thumb i’d love for the infinite menu to start his action again.
I know is not easy and for me is very hard to do this stuff because i usually do it once a year (or when i feel like changing my site ) so my knowledge of flash is just basic and this is just a passion that i have and if is possible and anyone can explain to me why doing certain moves it would help a lot more than just the answer.
Anyway sorry 4 the long email and the bad english(not my main language) if anyone could help i would really appreciate.
Thanks a lot
Massimo