# Gallery has gone bonky - portrait / landscape issue

**URL:** <https://forum.kirupa.com/t/gallery-has-gone-bonky-portrait-landscape-issue/182645>\
**Category:** Uncategorized\
**Created:** [March 20, 2006, 10:00am UTC](https://forum.kirupa.com/t/gallery-has-gone-bonky-portrait-landscape-issue/182645 "2006-03-20T10:00:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yabai](https://avatars.discourse-cdn.com/v4/letter/y/958977/32.png) [@yabai](https://forum.kirupa.com/u/yabai)\
**Post date:** [March 20, 2006, 10:00am UTC](https://forum.kirupa.com/t/gallery-has-gone-bonky-portrait-landscape-issue/182645/1 "2006-03-20T10:00:03Z")

</div>

hi,

i am building an xml gallery that pops up portrait and landscape images. the pop-up should fit each image. I had this working fine with the code below and then I added a few landscape images with different dimensions. now the landscape ones all pop-up with too much space around them.

the first part of the function just puts the imeges in the right place on the movie;

frame\_grabber.onEnterFrame = function() {  
\_root.myMonkey = \_root.picture.\_width;  
if (\_root.myMonkey\>308) {  
\_root.picture.\_x = (888+50)-\_root.picture.\_width-18;  
\_root.picture.\_y = 487-\_root.picture.\_height-18;  
} else {  
\_root.picture.\_x = 614.4;  
\_root.picture.\_y = 68.0;  
}  
\_root.myWidth = Math.floor(\_root.picture.\_width_1.565);  
\_root.myHeight = Math.floor(\_root.picture.\_height_1.57);  
};

i tried to add an if statement to detect the width of the small image and then apply the maths accordingly but it doesn’t do anything.

frame\_grabber.onEnterFrame = function() {  
\_root.myMonkey = \_root.picture.\_width;  
if (\_root.myMonkey\>308) {  
\_root.picture.\_x = (888+50)-\_root.picture.\_width-18;  
\_root.picture.\_y = 487-\_root.picture.\_height-18;  
} else {  
\_root.picture.\_x = 614.4;  
\_root.picture.\_y = 68.0;  
}  
if (\_root.myWidth = 401) {  
\_root.myWidth = Math.floor(\_root.picture.\_width_1.565);  
\_root.myHeight = Math.floor(\_root.picture.\_height_1.57);  
} else if (\_root.myWidth = 475) {  
\_root.myWidth = Math.floor(\_root.picture.\_width_1.322);  
\_root.myHeight = Math.floor(\_root.picture.\_height_1.199);  
}  
};

can anyone see where i am going wrong? any advice would stop me tearing the remaing hairs from my head. cheers

btw, there is a button that sends the pop-up info to the function above with this code;

on (release) {  
target\_winName = “gallery”;  
\_root.width = \_root.myWidth+20;  
\_root.height = \_root.myHeight+55;  
toolbar = 0;  
location = 0;  
directories = 0;  
status = 0;  
menubar = 0;  
scrollbars = 0;  
resizable = 1;  
//sends data back to the function  
openWinCentre(address, target\_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);  
}

---

<div class="post-metadata">

**Author:** ![yabai](https://avatars.discourse-cdn.com/v4/letter/y/958977/32.png) [@yabai](https://forum.kirupa.com/u/yabai)\
**Post date:** [March 20, 2006, 12:05pm UTC](https://forum.kirupa.com/t/gallery-has-gone-bonky-portrait-landscape-issue/182645/2 "2006-03-20T12:05:02Z")

</div>

the answer was there before my very eyes.

frame\_grabber.onEnterFrame = function() {  
\_root.myMonkey = \_root.picture.\_width;  
if (\_root.myMonkey\>308) {  
\_root.picture.\_x = (888+50)-\_root.picture.\_width-18;  
\_root.picture.\_y = 487-\_root.picture.\_height-18;  
\_root.myWidth = Math.floor(\_root.picture.\_width_1.322);  
\_root.myHeight = Math.floor(\_root.picture.\_height_1.199);  
} else {  
\_root.picture.\_x = 614.5;  
\_root.picture.\_y = 68.0;  
\_root.myWidth = Math.floor(\_root.picture.\_width_1.565);  
\_root.myHeight = Math.floor(\_root.picture.\_height_1.57);  
}  
};
