Difference between revisions of "Bookclick.as"

From Organic Design wiki
m
m
Line 7: Line 7:
 
i = 0;
 
i = 0;
 
speed = 12;
 
speed = 12;
 +
 +
function reduce() {
 +
if (i) pageTurn (i-=speed);
 +
}
 +
 
// This initialises the book page lines
 
// This initialises the book page lines
 
createEmptyMovieClip("book",1);
 
createEmptyMovieClip("book",1);
Line 39: Line 44:
 
endFill();
 
endFill();
 
}
 
}
function reduce() {
+
 
if (i) pageTurn (i-=speed);
 
}
 
  
 
book.onMouseUp = function () {
 
book.onMouseUp = function () {
 
i=Stage.width-margin;
 
i=Stage.width-margin;
 
}
 
}

Revision as of 02:23, 20 December 2006

// Code for [[SWF e-book]] is liscenced under [[[[1]]]] margin = 50; w = (Stage.width-margin*2)/2; h = Stage.height-margin*2; ox = margin+w; oy = margin; i = 0; speed = 12;

function reduce() { if (i) pageTurn (i-=speed); }

// This initialises the book page lines createEmptyMovieClip("book",1);

function pageTurn(i) {

x = i-ox; y = 0;

       if (x>w) x = w;
       if (x<-w) x = -w;

dx = w-x; Zx = x+dx/2;

// Draw page clear(); lineStyle(3,0); moveTo(ox,oy); lineTo(ox,oy+h); moveTo(ox-w,oy); lineTo(ox+Zx,oy); lineTo(ox+Zx,oy+h); lineTo(ox-w,oy+h); lineTo(ox-w,oy);

beginFill(0xdddddd,100); moveTo(ox+x,oy); lineTo(ox+Zx,oy); lineTo(ox+Zx,oy+h);

lineTo(ox+x,oy+h); lineTo(ox+x,oy+y); endFill(); }


book.onMouseUp = function () { i=Stage.width-margin; }