Difference between revisions of "Bookclick.as"

From Organic Design wiki
m
m
Line 46: Line 46:
 
i=Stage.width-margin;
 
i=Stage.width-margin;
 
}
 
}
 
reduce();
 

Revision as of 02:22, 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; // 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(); } function reduce() { if (i) pageTurn (i-=speed); }

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