Difference between revisions of "Gallery.as"

From Organic Design wiki
m
({{as}})
 
(46 intermediate revisions by 2 users not shown)
Line 1: Line 1:
#include 'debug.as';
+
// Image Gallery{{as}}
 
layer = 99999;
 
layer = 99999;
  
Line 8: Line 8:
  
 
// gallery metrics
 
// gallery metrics
 +
originX = 10;
 +
originY = 30;
 
maxColumns = 3;
 
maxColumns = 3;
 
maxRows = 4;
 
maxRows = 4;
 
thumbSpacing = 10;
 
thumbSpacing = 10;
 +
thumbSquare = 100;
  
 
// list of images
 
// list of images
// TODO get this from socket or GET
+
// TODO get this from socket or loadVars
 
var pic = new Array();
 
var pic = new Array();
pic[0] = "purple.jpg";
+
pic.push( "/purple.jpg");
pic[1] = "purple.jpg";
+
pic.push( "/purple.jpg");
pic[2] = "purple.jpg";
+
pic.push( "/purple.jpg");
pic[3] = "purple.jpg";
+
pic.push( "/purple.jpg");
 +
pic.push( "/purple.jpg");
 +
pic.push( "/purple.jpg");
 +
pic.push( "/purple.jpg");
  
for ( i = 0; i < pic.length; i++) {
+
count = 0;
    echo( pic[i] );
+
 
    }
+
button = new Array();
 +
 
 +
for ( y = 0; y < maxRows; y++) {
 +
for ( x = 0; x < maxColumns; x++) {
  
function thumb( parentMovieClip, layer, imageUrl, x, y ) {
+
name = "thumb" + count;
    var name = 'thumb'+layer;
+
echo(name);
    parentMovieClip.createEmptyMovieClip( name, layer );
+
_root.createEmptyMovieClip( name, _root.layer-- );
    this.thumb = parentMovieClip[name];
 
    this.thumb.loadMovie( imageUrl );
 
    this.thumb._x = x;
 
    this.thumb._y = y;
 
    this.onRollOver  = function() {
 
        this.thumb._alpha = 60;
 
        };  
 
  
    this.onRollOut  = function() {
+
var thumb = _root[name];
        this.thumb._alpha = 100;
+
thumb.loadMovie( thumbPath + pic[count++] );
        };  
+
thumb._x = x * (thumbSquare+thumbSpacing) + originX;
 +
thumb._y = y * (thumbSquare+thumbSpacing) + originY;
 +
thumb._alpha = 50;
 +
thumb.onPress = function () {
 +
this._alpha = 50;
 +
};
  
 +
button.push(thumb);
 +
}
 
     }
 
     }
  
something = new thumb( _root, layer--, "/w/angela-images/small/purple.jpg", 10, 10 );
+
echo(button[0]);
 +
 
  
  

Latest revision as of 23:01, 10 June 2007

// Image GalleryTemplate:As layer = 99999;

// paths in webspace for image access imageRoot = "/w/angela-images"; thumbPath = imageRoot + "/small"; imagePath = imageRoot + "/big";

// gallery metrics originX = 10; originY = 30; maxColumns = 3; maxRows = 4; thumbSpacing = 10; thumbSquare = 100;

// list of images // TODO get this from socket or loadVars var pic = new Array(); pic.push( "/purple.jpg"); pic.push( "/purple.jpg"); pic.push( "/purple.jpg"); pic.push( "/purple.jpg"); pic.push( "/purple.jpg"); pic.push( "/purple.jpg"); pic.push( "/purple.jpg");

count = 0;

button = new Array();

for ( y = 0; y < maxRows; y++) { for ( x = 0; x < maxColumns; x++) {

name = "thumb" + count; echo(name); _root.createEmptyMovieClip( name, _root.layer-- );

var thumb = _root[name]; thumb.loadMovie( thumbPath + pic[count++] ); thumb._x = x * (thumbSquare+thumbSpacing) + originX; thumb._y = y * (thumbSquare+thumbSpacing) + originY; thumb._alpha = 50; thumb.onPress = function () { this._alpha = 50; };

button.push(thumb); }

   }

echo(button[0]);



// per-frame function function reduce() { }