Difference between revisions of "Gallery.as"

From Organic Design wiki
m
m
Line 29: Line 29:
 
for ( y = 0; y < maxRows; y++) {
 
for ( y = 0; y < maxRows; y++) {
 
for ( x = 0; x < maxColumns; x++) {
 
for ( x = 0; x < maxColumns; x++) {
 +
 
var name = "thumb" + count;
 
var name = "thumb" + count;
 
_root.createEmptyMovieClip( name, layer-- );
 
_root.createEmptyMovieClip( name, layer-- );
 +
 
var thumb = _root[name];
 
var thumb = _root[name];
 
thumb.loadMovie( thumbPath + pic[count++] );
 
thumb.loadMovie( thumbPath + pic[count++] );
 
thumb._x = x * (thumbSquare+thumbSpacing);
 
thumb._x = x * (thumbSquare+thumbSpacing);
 
thumb._y = y * (thumbSquare+thumbSpacing);
 
thumb._y = y * (thumbSquare+thumbSpacing);
_root[name].onPress = function() {
+
thumb.onPress = function() {
_root[name]._alpha = 50;
+
thumb._alpha = 50;
 
};
 
};
 +
button.push(thumb);
 
}
 
}
 
     }
 
     }

Revision as of 04:56, 11 April 2006

layer = 99999;

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

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

// list of images // TODO get this from socket or GET 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++) {

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

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

   }


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