Hi
This Gallery-Thumbs-Slider is told to appear with
btn1.onRelease = function() {
slider.setGal(thumbnails1, images1);
};
Code inside the Thumbs-Slider
var thumb = new Array();
var images = new Array();
var big_images = new Array();
var left = 0;
var right = 0;
// Checking distance between thumbnails
var distance = 0;
var tester = container.attachMovie("thumbnail", "tester", 0);
distance = int(tester._width+5);
// Gap between thumbs
tester.removeMovieClip();
// Set Galery
function setGal(arr, big_arr) {
thumb = new Array();
images = new Array();
big_images = new Array();
images = arr;
big_images = big_arr;
container._visible = false;
for (var i = 0; i<arr.length; i++) {
thumb* = container.createEmptyMovieClip("loader"+i, i);
thumb*.createEmptyMovieClip("img", 1);
thumb*.img.loadMovie(arr*);
}
preload();
}
// Preload images
function preload() {
for (var i = 0; i<thumb.length; i++) {
thumb*.stime = getTimer();
}
this.onEnterFrame = function() {
var cur = 0;
var max = 0;
var scalable = true;
for (var i = 0; i<thumb.length; i++) {
var c = thumb*.img.getBytesLoaded();
var m = thumb*.img.getBytesTotal();
if (c>10) {
cur += c;
}
if (m>10) {
max += m;
} else {
if (getTimer()-thumb*.stime<3000) {
// image timeout
scalable = false;
}
}
}
if (cur>10 && scalable == true) {
var percent = cur*100/max;
loader.setPerc(percent);
if (percent>=100) {
arrange(images, big_images);
}
}
};
}
// Creating thumbnail instances
function arrange(arr, big_arr) {
delete this.onEnterFrame;
var amt = Math.round(mask._width/(arr.length*distance))+1;
var count = 0;
for (var i = 0; i<amt; i++) {
for (var h = 0; h<arr.length; h++) {
thumb[count] = container.attachMovie("thumbnail", "thumb"+count, count);
thumb[count].big_img = big_arr[h];
thumb[count].img = arr[h];
thumb[count]._x = int(count*distance);
count++;
}
}
startWatch();
}
// Moving thumbnails by mouse
function startWatch() {
left = 0;
right = thumb.length-1;
container._visible = true;
var spd = 0;
this.onEnterFrame = function() {
if (mask.hitTest(_parent._xmouse, _parent._ymouse, false)) {
var dst = mask._width/2-mask._xmouse;
var sgn = dst/Math.abs(dst);
var dspd = Math.pow(Math.abs(dst), 1.1)/30*sgn;
spd += (dspd-spd)/3;
} else {
spd /= 1.1;
}
for (var i = 0; i<thumb.length; i++) {
thumb*._x += int(spd);
}
if (spd<0) {
if (thumb[left]._x<-thumb[left]._width) {
putRight(left);
}
} else {
if (thumb[right]._x>mask._width) {
putLeft(right);
}
}
};
}
function putRight(n) {
if (n>0) {
thumb[n]._x = thumb[n-1]._x+distance;
left = (left == thumb.length-1) ? 0 : left+1;
} else {
thumb[n]._x = thumb[thumb.length-1]._x+distance;
left++;
}
right = n;
}
function putLeft(n) {
if (n<thumb.length-1) {
thumb[n]._x = thumb[n+1]._x-distance;
right = (right == 0) ? thumb.length-1 : right-1;
} else {
thumb[n]._x = thumb[0]._x-distance;
right--;
}
left = n;
}
How can I tell the Slider to appear when the swf is loaded?
Offcourse I tried with onLoad and onEnterframe, but nothing works.