I am using a horizontal thumb scroller which i ahd acuired from the internet. the scroller works fine but the issue is, the scroll speed is directly related to teh thumbnails present. When i am having 10-20 thumbs the auto scroll is smooth. but when the thumbs increase to say 50+ even the slightest mouse movement cause the the thumb to scroll at rapid pace rendering the thumbnail scroller useless. Can anyone help me to modify the script so that i can reduces or control teh scroll speed. Or if tahts not possible how do i add a next prev button so taht i can take away the auto scroll and fwd/rewind the thumbs one by one or a batch at each click. I am attching the fla file for reference.
// Developed by www.flashmo.com
var photo_filename:Array = new Array();
var photo_thumbnail:Array = new Array();
var photo_description:Array = new Array();
//var gallery_name:Array = new Array("Bain Ave", "Esplanade", "Flip this House", "John St", "Overlooking the Park", "Roncesvalles Village", "South Riverdale Pape", "South Riverdale", "The Ultimate Bachelor Pad");
//var gallery_file:Array = new Array("bain-ave", "esplanade", "flip-this-house", "john-st", "overlooking-the-park", "roncesvalles-village", "south-riverdale-pape", "south-riverdale", "the-ultimate-bachelor-pad");
//var no_of_gallery:Number = gallery_name.length;
var folder:String = "photos/";
var total:Number;
var g:Number = 0;
var i:Number = 0;
var j:Number = 0;
var k:Number = 0;
var p:Number = 0;
var border_size:Number = 1;
var scrolling_speed:Number = 0.15; // 0.00 to 1.00
var cv:Number = 0;
var cv_old:Number = 0;
var onDrag:Boolean;
var xml:XML = new XML();
sub_button._visible = false;
tn_area._visible = false;
stop();
///////////////////////////////////////////////////////////////
function buttonstate(){
if (p>=total-1) {next_btn._alpha=10;}else{next_btn._alpha=100; }
if (p<1) { previous_btn._alpha=10; }else{previous_btn._alpha=100;}
}
function changeGallery(no)
{
/*buttonstate();
for( i = 0; i < no_of_gallery; i++ )
{
this["sub_button" + i].button_mc._visible = true;
this["sub_button" + i].graphic_bg1._visible = true;
this["sub_button" + i].graphic_bg2._visible = false;
}
this["sub_button" + no].button_mc._visible = false;
this["sub_button" + no].graphic_bg1._visible = false;
this["sub_button" + no].graphic_bg2._visible = true;
xml.load( gallery_file[no] + ".xml");*/
xml.load( no + ".xml");
xml.ignoreWhite = true;
}
//changeGallery(0); // set default gallery at first loading
///////////////////////////////////////////////////////////////
xml.onLoad = function()
{
for( i = 0; i < total; i++ )
removeMovieClip(tn_group["tn"+i]);
tn_group.tn._visible = false;
var nodes = this.firstChild.childNodes;
total = nodes.length;
///////////////////////////////////////////////////////////////
for( i = 0; i < total; i++)
{
photo_filename* = nodes*.attributes.filename;
photo_thumbnail* = nodes*.attributes.thumbnail;
photo_description* = nodes*.attributes.description;
}
j = k = p = 0;
g++;
create_tn();
scroller();
play();
}
///////////////////////////////////////////////////////////////
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
////////////////////////////////////
function nextImage() {
if (p<(total-1)) {
p++;
buttonstate();
//trace(p);
//photo_filename[p] = nodes[p].attributes.filename;
photo_thumbnail[p] = nodes[p].attributes.thumbnail;
pic_desc.txt.value = nodes[p].attributes.description;
play();
}}
function prevImage() {
if (p>0) {
p--;
buttonstate();
//trace(p);
//photo_filename[p] = nodes[p].attributes.filename;
photo_thumbnail[p] = nodes[p].attributes.thumbnail;
pic_desc.txt.value= nodes[p].attributes.description;
play();
}}
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
var THUMBW:Number = 70; // width of each thumbnail
var THUMBH:Number = 70; // height
function grow() {
this.onEnterFrame = function() {
if (this._width < THUMBW * 1.2) {
this._x -= this._width * .025;
this._y -= this._height * .025;
this._width *= 1.05;
this._height *= 1.05;
} else delete this.onEnterFrame;
};
}
// thumbnail rollout handler
function shrink() {
this.onEnterFrame = function() {
if (this._width > THUMBW) {
this._width /= 1.05;
this._height /= 1.05;
this._x += this._width * .025;
this._y += this._height * .025;
} else delete this.onEnterFrame;
};
}
function create_tn():Void
{
for( i = 0; i < total; i++)
{
buttonstate();
var t = tn_group.tn.duplicateMovieClip("tn"+i, i);
t.pic.loadMovie( folder + photo_thumbnail* );
t.tn_no = i;
t._x = j * 80;
//t._y = k * 90;
j++;
if( i % 1 == 1 ) { j = 0; j++; }
t.onEnterFrame = function()
{
buttonstate();
var bytes_loaded:Number = this.pic.getBytesLoaded();
var bytes_total:Number = this.pic.getBytesTotal();
var percent:Number = 0;
this.bd._width = this.bd._height = 50;
//this.bd._alpha = 20;
this.bd._x = this.bd._y = 15;
percent = Math.round( bytes_loaded / bytes_total * 100 );
if( percent != 100 && percent > 0)
this.info.text = percent + "%";
else
this.info.text = "0%";
if( percent == 100 )
{
this.pic._width = 60;
this.pic._height = 60;
this.info.text = "";
this.pic._x = (80 - this.pic._width) * 0.5 + border_size;
this.pic._y = (80 - this.pic._height)* 0.5 + border_size;
this.bd._alpha = 100;
this.bd._width = this.pic._width + border_size * 2;
this.bd._height = this.pic._height + border_size * 2;
this.bd._x = this.pic._x - border_size;
this.bd._y = this.pic._y - border_size;
}
}
t.onRollOver = function()
{
this.pic._alpha = 70;
//this.pic._width = 70;
//this.pic._height = 70;
grow();
/*this.pic._alpha = 75;
//this.pic.gotoAndPlay(2);
this.pic._width = 80;
this.pic._height = 80;*/
}
t.onRollOut = function()
{
this.pic._alpha = 100;
this.pic._width = 60;
this.pic._height = 60;
}
t.onRelease = function()
{
buttonstate();
p = this.tn_no;
play();
}
}
}
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems(); _root.menu = theMenu;
var item:ContextMenuItem = new ContextMenuItem("", flashmo);
theMenu.customItems[0] = item;
function flashmo() { getURL(""); }
function scroller():Void
{
scroller_mc._x = scrollable_area_mc._x;
tn_group._x = tn_area._x;
sr = tn_area._width/tn_group._width;
scroller_mc._width = scrollable_area_mc._width * sr;
sd = scrollable_area_mc._width - scroller_mc._width;
cd = tn_group._width - tn_area._width;
cr = cd / sd;
tn_group.setMask(tn_area);
if( tn_group._width <= tn_area._width )
{
scroller_mc._visible = scrollable_area_mc._visible = false;
}
else
{
scroller_mc._visible = scrollable_area_mc._visible = true;
}
scroller_mc.onEnterFrame = function()
{
if(this._width<100){
this.startDrag(false, this._x, scrollable_area_mc._x, scrollable_area_mc._x + scrollable_area_mc._width - this._width + 1);
onDrag = true;}else{
onDrag = false;}
this.onEnterFrame = function()
{
//trace(tn_area._x+" a, " + scrollable_area_mc._x+" b, " + (cr - this._x) + " c, " + cr)
new_x = tn_area._x + scrollable_area_mc._x*cr - this._x*cr;
cv = (new_x - tn_group._x) * scrolling_speed;
tn_group._x += cv;
if( onDrag == false && cv_old == cv )
delete this.onEnterFrame;
cv_old = cv;
}
}
//scroller_mc.onRelease = scroller_mc.onRelease = function()
//{
//this.stopDrag();
//onDrag = true;
//}
}