Problem:
Currently the script (*.as file) is usefull for square or Portrait photographs
but when a 'Landscape' image is used, the code is using the width of the image
(770 in the xml file) as the vertical height of the display area.
IE: The image is 770 x 440. The display area being created, by the script in
the *.as file, is 770 x 770
I have tried for 2 days to override (hardcode) but am not having any luck.
(And am only sending myself mad ).
Hope the explaination is acurate enough.....
The working example is at
http://www.lumieres.com.au/latest/index.html and the
problem is evident in the fact there is a proportional gap above and below the
image as the image is siting in an area 770x770 and not 770 x 440.
//SIMPLE VIEWER v1.7
#include "modLoaderClass.as"
#include "tween.as"
STRIPPED.....
//get data from XML
_global.gImageMaxDim = int(gXMLRoot.attributes.maxImageDimension);
// maxImageDimension is set at 770 in XML file.
// It is this that is being used to set the height of the image area to 770
(When I actually want it at 450)
STRIPPED.......
////////////////
// RESIZE
///////////////
function doLayout(){
trace("doLayout");
if (gStageWidth == undefined){
stageWidth = Stage.width;
stageHeight = Stage.height;
}else{
stageWidth = gStageWidth;
stageHeight = gStageHeight;
}
trace("stage width: " + stageWidth);
//calculate display area
//-------------------
if (navPosition == "left" || navPosition == "right"){
displayWidth = stageWidth - (stageGutter*3) - gThumbAreaWidth;
displayHeight = stageHeight- (stageGutter*2);
}else{
displayWidth = stageWidth - (stageGutter*2) ;
displayHeight = stageHeight- (stageGutter*3) - gThumbAreaHeight;
}
//get min of width/height
if (displayWidth < displayHeight){
displayDim = displayWidth;
}else{
displayDim = displayHeight;
}
// get min of disp dim and XML max dim
MaxDisplayDim = gImageMaxDim + imageBorderWidth*2;
if (MaxDisplayDim < displayDim){
displayDim = MaxDisplayDim;
}
displayDim = Math.floor(displayDim);
UIWidth = displayDim+gThumbAreaWidth + stageGutter;
UIHeight = displayDim+gThumbAreaHeight + stageGutter;
//set coords
switch (navPosition) {
case "top":
thumbAreaY = Math.floor((stageHeight - UIHeight)/2);
displayAreaY = Math.floor(thumbAreaY + gThumbAreaHeight);
displayAreaX = Math.floor((stageWidth - displayDim)/2);
thumbAreaX = Math.floor((stageWidth - gThumbAreaWidth)/2) +
gThumbAreaWidth;
break;
case "bottom":
displayAreaY = Math.floor((stageHeight - UIHeight)/2);
displayAreaX = Math.floor((stageWidth - displayDim)/2);
thumbAreaY = Math.floor(displayAreaY + displayDim);
thumbAreaX = Math.floor((stageWidth - gThumbAreaWidth)/2) +
gThumbAreaWidth;
break;
case "left":
displayAreaY = Math.floor(0);
thumbAreaX = Math.floor((stageWidth - UIWidth)/2 + gThumbAreaWidth);
thumbAreaY = Math.floor((stageHeight - gThumbAreaHeight)/2);
displayAreaX = Math.floor(thumbAreaX + stageGutter);
break;
default:
displayAreaY = Math.floor((stageHeight - displayDim)/2);
thumbAreaX = stageWidth - Math.floor((stageWidth - UIWidth)/2);
thumbAreaY = Math.floor((stageHeight - gThumbAreaHeight)/2);
displayAreaX = Math.floor(thumbAreaX -( stageGutter+displayDim+
gThumbAreaWidth));
}
gmcThumbArea._x = thumbAreaX;
gmcThumbArea._y = thumbAreaY;
gmcDisplayArea._x = displayAreaX;
gmcDisplayArea._y = displayAreaY;
gmcDisplayArea._width = displayDim;
gmcDisplayArea._height = displayDim;
******************* //THIS ABOVE IS WHAT I HAVE BEEN ADJUSTING. TO NO
AVAIL.....
STRIPPED BELOW THIS