Hi there,
I'm having some trouble writing a correct algorithm for centering a background image. Here's a link to the effect I'm getting right now: http://www.pilotinteractive.ca/dev/.
Here's a sample of what I'm aiming for: http://flashden.net/item/easy-xml-background-image-rotator/full_screen_preview/22015
Here's the not-so-great function I devised:
public function calculateSize():Array {
var width = stage.stageWidth;
var height = stage.stageWidth / aspectRate;
while (1) {
if (height > stage.stageHeight) {
break;
}
width += 25;
height = width / aspectRate;
}
return new Array(width, height);
}
I believe the mistake I've made is in adjusting to height? Pointers would be great :-) if you resize the window and play around with it you can likely see what I mean.
Best!