AS3 Photo Gallery Movie Clip Tween

I’ve made a photo gallery that scales from the center with the browser window size. Now I’m trying to make it so when window scales the gallery tweens to fit the new size, but I can’t seem to figure out how to implement it into my previously written code. Here is all the code, sorry its a lot to sift through. I’ve put some notes in the important sections.

import fl.transitions.;
import fl.transitions.Tween;
import fl.transitions.easing.
import flash.display.StageAlign;
import flash.display.StageScaleMode;
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.dispatchEvent(new Event(Event.RESIZE));

// Code for to scale the photo gallery with the window size
var wTween:Tween;
var hTween:Tween;
wTween = new Tween (gallery, “height”, Strong.easeOut, gallery.height, (stage.stageHeight-30), 1, true);
hTween = new Tween (gallery, “width”, Strong.easeOut, gallery.width, (stage.stageWidth-230), 1, true);

//Code to center the gallery and scale it with the window size
stage.addEventListener(Event.RESIZE, resizeListener);
function resizeListener (e:Event):void {
trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
gallery.width = stage.stageWidth-40;
gallery.height = stage.stageHeight-40;
(gallery.scaleX < gallery.scaleY ) ? gallery.scaleY = gallery.scaleX : gallery.scaleX = gallery.scaleY;
gallery.x = (gallery.stage.stageWidth / 2) - (gallery.width / 2);
gallery.y = (gallery.stage.stageHeight / 2) - (gallery.height / 2);

//Image Smoothing
function loadProdComplete(e:Event):void {
var bit:Bitmap =;
if(bit != null)
bit.smoothing = true;

//Load 1.jpg into a movieclip
var i =new Loader();
i.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
i.load(new URLRequest(“1.jpg”));