1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| leftCommentClip = _root.createEmptyMovieClip("leftCommentHolder", _root.getNextHighestDepth());
rightCommentClip = _root.createEmptyMovieClip("rightCommentHolder", _root.getNextHighestDepth());
myBook.onPutPage = function(){
var leftPageNumber = this.leftPageNumber;
var rightPageNumber = this.rightPageNumber;
// if left page is visible
if( leftPageNumber != undefined )
attachComment( "left", leftPageNumber+1 );
else
leftCommentClip._visible = false;
// if right page is visible
if( rightPageNumber != undefined )
attachComment( "right", rightPageNumber+1 );
else
rightCommentClip._visible = false;
}
function attachComment( position, pageNumber ){
if( position == "right" ){
rightCommentClip._visible = true;
rightCommentClip.attachMovie("comment"+pageNumber,"comment", 0);
leftCommentClip._visible = true;
leftCommentClip.attachMovie("comment"+pageNumber,"comment", 0);
// center under the right page
rightCommentClip._x = myBook._x + myBook.width / 4 - rightCommentClip._width/2;
leftCommentClip._x = myBook._x - myBook.width / 4 - leftCommentClip._width/2;
// 10 pixels under the book
rightCommentClip._y = myBook._y + myBook.height / 2 + 10;
leftCommentClip._y = myBook._y + myBook.height / 2 + 10;
}
} |
Partager