Difference between revisions of "Gallery.as"

From Organic Design wiki
m
({{as}})
 
(88 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
// Image Gallery{{as}}
 
layer = 99999;
 
layer = 99999;
  
function thumb( handle, x, y, imageUrl ) {
+
// paths in webspace for image access
    this.imageUrl = imageUrl;
+
imageRoot = "/w/angela-images";
    this.handle = handle;
+
thumbPath = imageRoot + "/small";
    this.x = x;
+
imagePath = imageRoot + "/big";
    this.y = y;
+
 
    this.createEmptyMovieClip(handle, _root.layer-- );
+
// 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++) {
  
thumb.prototype.sayHello = function() {
+
name = "thumb" + count;
    echo "My URL is " + this.imageURL;
+
echo(name);
    };
+
_root.createEmptyMovieClip( name, _root.layer-- );
  
bob = new thumb( 'sponge', 10, 10, "/w/angela-images/small/purple.jpg" );
+
var thumb = _root[name];
bob.sayHello();
+
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);
 +
}
 +
    }
  
//createEmptyMovieClip('thumb', layer-- );
+
echo(button[0]);
//thumb.loadMovie("/w/angela-images/small/purple.jpg");
 
  
/*
 
with (thumb) {
 
_x = 0;
 
_y = 0;
 
}
 
*/
 
// start drag
 
femaleCap.onPress = function() {
 
//    this.startDrag( false, 0, 0, 600-width-2, 400-height-2 );
 
    this.startDrag();
 
    };
 
  
// drag end
 
femaleCap.onRelease = function() {
 
    this.stopDrag();
 
    }; 
 
  
// drag end
 
_root.onDragOut = function() {
 
    this.stopDrag();
 
    };
 
  
 
// per-frame function
 
// per-frame function
 
function reduce() {
 
function reduce() {
 
}
 
}

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() { }