Connecting Tech Pros Worldwide Forums | Help | Site Map

need help adding thumbnails and scroll buttons

anfetienne's Avatar
Needs Regular Fix
 
Join Date: Feb 2009
Location: UK
Posts: 356
#1: Jul 24 '09
ive been through a tutorial on using array for a gallery and wrote the following code.

i need to include thumbnails with left and right buttons on each side to scroll through the thumbnails

MY CODE
Expand|Select|Wrap|Line Numbers
  1. #include "64516994.txt"
  2.  
  3. this.fadeSpeed = 20;
  4. this.pIndex = 0;
  5.  
  6. loadMovie(this.locVar[0], _root.photo);
  7. MovieClip.prototype.changePhoto = function(d) {
  8.     // make sure pIndex falls within pArray.length
  9.     this.pIndex = (this.pIndex+d)%this.locVar.length;
  10.     if (this.pIndex<0) {
  11.         this.pIndex += this.locVar.length;
  12.     }
  13.     this.onEnterFrame = fadeOut;
  14. };
  15. MovieClip.prototype.fadeOut = function() {
  16.     if (this.photo._alpha>this.fadeSpeed) {
  17.         this.photo._alpha -= this.fadeSpeed;
  18.     } else {
  19.         this.loadPhoto();
  20.     }
  21. };
  22. MovieClip.prototype.loadPhoto = function() {
  23.  
  24.     var p = _root.photo;
  25.  
  26.     p._alpha = 0;
  27.     p.loadMovie(this.locVar[this.pIndex]);
  28.     this.onEnterFrame = loadMeter;
  29. };
  30. MovieClip.prototype.loadMeter = function() {
  31.     var i, l, t;
  32.     l = this.photo.getBytesLoaded();
  33.     t = this.photo.getBytesTotal();
  34.     if (t>0 && t == l) {
  35.         this.onEnterFrame = fadeIn;
  36.     } else {
  37.         trace(l/t);
  38.     }
  39. };
  40. MovieClip.prototype.fadeIn = function() {
  41.     if (this.photo._alpha<100-this.fadeSpeed) {
  42.         this.photo._alpha += this.fadeSpeed;
  43.     } else {
  44.         this.photo._alpha = 100;
  45.         this.onEnterFrame = null;
  46.     }
  47. };
  48. // Actions -----------------------------------------
  49. // these aren't necessary, just an example implementation
  50. this.onKeyDown = function() {
  51.     if (Key.getCode() == Key.LEFT) {
  52.         this.changePhoto(-1);
  53.     } else if (Key.getCode() == Key.RIGHT) {
  54.         this.changePhoto(1);
  55.     }
  56. };
  57. Key.addListener(this);
  58.  
i have attached the fla that i would like my gallery to be similar to....if there are tutorials that can help please do tell.
Attached Files
File Type: zip gallery.zip (19.4 KB, 20 views)

Reply