stop();
myBook._visible = true;
var zoomRatios = [2,3,4,5];
var zoomed = false;
var zoomCount = 0;
navbar_mc.index_btn.onPress = gotoPage;
navbar_mc.next_btn.onPress = nextPage;
navbar_mc.prev_btn.onPress = prevPage;
zoom_mc.zoom_in_btn.onPress = openZoom;
zoom_mc.zoom_out_btn.onPress = closeZoom;
zoom_mc.zoom_out_btn._visible = false;
service_mc.help_btn.onPress = openInfoWindow;
service_mc.print_left_btn.onPress = printLeftPage;
service_mc.print_right_btn.onPress = printRightPage;
myBook.onPageLoad = function( pageURL, pageNumber ){
if( pageNumber == 0 )this.flipCorner("top-right");
}
myBook.onStartFlip = function(i) {
if (i == undefined) {
return;
}
myBook.flipOnClickProp = true;
showHint();
};
myBook.onFlipBack = function() {
myBook.flipOnClickProp = false;
hideHint();
};
myBook.onClick = function(i, page, isCorner) {
hideHint();
};
myBook.onPutPage = function() {
myBook.flipOnClickProp = false;
var res = "";
if (this.leftPageNumber && this.rightPageNumber) {
res = this.leftPageNumber+" / "+this.rightPageNumber;
} else if (this.rightPageNumber == 0) {
res = this.rightPageNumber;
} else if (this.leftPageNumber && !this.rightPageNumber) {
res = this.leftPageNumber;
}
navbar_mc.current_page_txt.text = res;
};
function sendData(){
var sender:LoadVars = new LoadVars();
//sender.sendAndLoad("http://ad.doubleclick.net/clk;201954821;9066607;j?",sender,"GET");
}
function nextPage() {
if( zoomed )return;
myBook.flipForward();
//sendData ("http://ad.doubleclick.net/clk;201954821;9066607;j?");
}
function prevPage() {
if( zoomed )return;
myBook.flipBack();
//sendData ("http://ad.doubleclick.net/clk;201954819;9066607;q?");
}
function gotoPage() {
if( zoomed )return;
myBook.flipGotoPage( 0 );
//sendData ("http://ad.doubleclick.net/clk;201954818;9066607;p?");
}
function startZoomingMode() {
zoomed = !zoomed;
if (zoomed) {
Mouse.hide();
myBook.enabledProp = false;
_root.attachMovie("ZoomPointer", "zoom_pointer_mc", 100);
zoom_pointer_mc._x = _xmouse;
zoom_pointer_mc._y = _ymouse;
zoom_pointer_mc.onMouseMove = function() {
this._x = _xmouse;
this._y = _ymouse;
};
} else {
Mouse.show();
myBook.enabledProp = true;
zoom_pointer_mc.removeMovieClip();
}
}
function openInfoWindow() {
myBook.enabledProp = false;
_root.attachMovie("InfoWindow", "info_mc", _root.getNextHighestDepth());
info_mc._x = Stage.width/2-info_mc._width/2;
info_mc._y = Stage.height/2-info_mc._height/2;
info_mc.close_btn.onRelease = closeInfoWindow;
}
function closeInfoWindow() {
myBook.enabledProp = true;
info_mc.removeMovieClip();
}
function printLeftPage() {
print_box.printIt(myBook.leftPageNumber, myBook);
}
function printRightPage() {
print_box.printIt(myBook.rightPageNumber, myBook);
}
/*function showHint() {
_root.attachMovie("Hint", "hint_mc", 215);
hint_mc._x = _xmouse;
hint_mc._y = _ymouse;
if( (hint_mc._y + hint_mc._height) > Stage.height )hint_mc._y -= ((hint_mc._y + hint_mc._height)-Stage.height + 10);
if( (hint_mc._x + hint_mc._width) > Stage.width )hint_mc._x -= ((hint_mc._x + hint_mc._width)-Stage.width + 10);
hint_mc.onMouseMove = moveHint;
Mouse.hide();
}
function moveHint(){
this._x = _xmouse;
this._y = _ymouse;
if( (this._y + this._height) > Stage.height )this._y -= ((this._y + this._height)-Stage.height + 10);
if( (this._x + this._width) > Stage.width )this._x -= ((this._x + this._width)-Stage.width + 10);
};
function hideHint() {
hint_mc.onMouseMove = undefined;
hint_mc.removeMovieClip();
Mouse.show();
}*/
function openZoom(){
myBook.enabledProp = false;
var ratio = zoomRatios[zoomCount++];
if( zoomRatios[zoomCount+1] == undefined )
zoom_mc.zoom_in_btn._visible = false;
else
zoom_mc.zoom_in_btn._visible = true;
if(!zoomed) {
ow = myBook._bookWidth;
oh = myBook._bookHeight;
drawZoomMask();
cx = myBook._x;
cy = myBook._y;
}
myBook.setSize(ow * ratio, oh * ratio);
var left = cx-myBook._bookWidth/2 + ow/2;
var top = cy-myBook._bookHeight/2 + oh/2;
var right = cx+myBook._bookWidth/2 - ow/2;
var bottom = cy+myBook._bookHeight/2 - oh/2;
mask_mc.onMouseDown = function(){myBook.startDrag(false, left, top, right,bottom);};
mask_mc.onMouseUp = function(){myBook.stopDrag();};
mask_mc.onRollOver = function(){};
zoomed = true;
zoom_mc.zoom_out_btn._visible = true;
}
function closeZoom(){
if(!zoomed)return;
if(zoomCount > 1){
zoomCount-=2;
openZoom();
return;
}
myBook.enabledProp = true;
myBook.setSize(ow, oh);
myBook._x = cx;
myBook._y = cy;
myBook.setMask(null);
mask_mc.removeMovieClip();
myBook.stopDrag();
mask_mc.onMouseDown = undefined;
mask_mc.onMouseUp = undefined;
zoomed = false;
zoomCount = 0;
zoom_mc.zoom_out_btn._visible = false;
zoom_mc.zoom_in_btn._visible = true;
}
function drawZoomMask(){
var cx = myBook._x;
var cy = myBook._y;
var x0 = cx - ow/2;
var y0 = cy - oh/2;
var x1 = cx + ow/2;
var y1 = cy + oh/2;
_root.createEmptyMovieClip( "mask_mc", 2000 );
mask_mc.lineStyle();
mask_mc.beginFill( 0, 100 );
mask_mc.moveTo( x0, y0 );
mask_mc.lineTo( x1, y0 );
mask_mc.lineTo( x1, y1 );
mask_mc.lineTo( x0, y1 );
mask_mc.lineTo( x0, y0 );
mask_mc.endFill();
myBook.setMask( mask_mc);
}
|