# Align objects when ResizeStage problems

**URL:** <https://forum.kirupa.com/t/align-objects-when-resizestage-problems/300297>\
**Category:** flash\
**Created:** [November 18, 2009, 9:06pm UTC](https://forum.kirupa.com/t/align-objects-when-resizestage-problems/300297 "2009-11-18T21:06:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![creacionro](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@creacionro](https://forum.kirupa.com/u/creacionro)\
**Post date:** [November 18, 2009, 9:06pm UTC](https://forum.kirupa.com/t/align-objects-when-resizestage-problems/300297/1 "2009-11-18T21:06:50Z")

</div>

I’m trying to align an object on the stage “mymenu” when the browser resizes.  
If I write a function to do that inside the flash document, it works properly but now I’m trying to do it from the main class that it called by the main swf.

```auto

private var stageW:uint = stage.stageWidth;
private var stageH: uint=stage.stageHeight;
///////////////////////////
public function main() {
     setsizeStage();
  }
///////////////////////////
private function setsizeStage():void {
   stage.scaleMode = StageScaleMode.NO_SCALE;
   stage.align = StageAlign.TOP_LEFT;
   stage.addEventListener(Event.RESIZE, resizeStage);
   stage.dispatchEvent(new Event(Event.RESIZE));
  }
///////////////////////////
private function resizeStage(event:Event):void {
   stageW = stage.stageWidth;
   stageH = stage.stageHeight;
   var menudestinyX:uint= (stageW/2)-100;
   var menudestinyY:uint= 100;
   trace(stageW+" "+stageH);
   TweenLite.to(mymenu, 1, {x:menudestinyX,y:menudestinyY, ease:Expo.easeOut});
  }
 

```

The output says me that “mymenu” property is not defined but the object is defined and added to de displaylist.:red:

What could be the problem?
