# How to limit size an object extends off the stage area

**URL:** <https://forum.kirupa.com/t/how-to-limit-size-an-object-extends-off-the-stage-area/240649>\
**Category:** flash\
**Created:** [October 4, 2007, 7:03pm UTC](https://forum.kirupa.com/t/how-to-limit-size-an-object-extends-off-the-stage-area/240649 "2007-10-04T19:03:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![beamond](https://avatars.discourse-cdn.com/v4/letter/b/e47774/32.png) [@beamond](https://forum.kirupa.com/u/beamond)\
**Post date:** [October 4, 2007, 7:03pm UTC](https://forum.kirupa.com/t/how-to-limit-size-an-object-extends-off-the-stage-area/240649/1 "2007-10-04T19:03:38Z")

</div>

I’m using the code below for a prebuilt page flip application. The problem i am having is that when i create the to a certain size, say 570x200, the pages as they are flipped extend outside of the stage area and so are cut off on the final exported swf. make sense? I’d need to be able to limit the amount of pixels that the pages extend off the page. A good example of this is here: [http://www.heidelberg.com/www/html/en/content/products/postpress/folders/stahlfolder\_ti36\_proline,overview](http://www.heidelberg.com/www/html/en/content/products/postpress/folders/stahlfolder_ti36_proline,overview)

I’m sure i need to just add some sort of line in below. Can you help??

var widePages = new Array();  
myBook.onInit = function() {  
var book = this;  
var n = book.totalPages;  
for (var i = 0; i\<n; i++) {  
var page = book.getPageLink(i);  
if (page.params.wide != undefined) {  
var lp = rp=i;  
var isOtherWide = false;  
if (page.isLeftPage) {  
rp = i+1;  
isOtherWide = (book.getPageLink(i+1).params.wide != undefined);  
} else {  
lp = i-1;  
isOtherWide = (book.getPageLink(i-1).params.wide != undefined);  
}  
if (isOtherWide) {  
widePages[lp+"\_"+rp] = {leftPage:lp, rightPage:rp, checked:false};  
}  
}  
}  
};  
function isPageWide(pageNumber) {  
var res = false;  
for (var layout in widePages) {  
if (widePages[layout].leftPage == pageNumber || widePages[layout].rightPage == pageNumber) {  
res = true;  
}  
}  
return res;  
}  
function getIndex(pageNumber) {  
for (var layout in widePages) {  
if (pageNumber == widePages[layout].leftPage || pageNumber == widePages[layout].rightPage) {  
return layout;  
}  
}  
return undefined;  
}  
myBook.onPageLoad = function(pageURL, pageNumber) {  
if (isPageWide(pageNumber) && !\_root.onEnterFrame) {  
\_root.onEnterFrame = checkWidePages;  
}  
};  
myBook.onPageUnload = function(pageNumber) {  
if (isPageWide(pageNumber)) {  
widePages[getIndex(pageNumber)].checked = false;  
}  
};  
myBook.onPageLoad = function(pageURL, pageNumber) {  
if (pageNumber == 0) {  
this.flipCorner(“bottom-right”);  
}  
};  
delay = 10000;  
// 1 second: 1000 ms  
forwardInterval = setInterval(myBook, “flipForward”, 10000);  
myBook.onLastPage = function() {  
clearInterval(forwardInterval);  
lastPageInterval = setInterval(closeLastPage, delay);  
};  
function closeLastPage() {  
myBook.flipGotoPage(0);  
clearInterval(lastPageInterval);  
forwardInterval = setInterval(myBook, “flipForward”, 10000);  
}
