Jump to content
GreenSock

1114rk

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by 1114rk

  1. i'm trying to centre the AutoFitArea object to stage that would update on Event.RESIZE but for some reason it goes off centre on resizing the window...

    essentially like the LiquidStage functionality, although maybe that's why there is the LiquidStage because "it doesn't work straight out of box" ???

     

    the code I'm using is as follows (with all the declarations and imports...)

     

    autoFitArea.attach(attachedImage, ScaleMode.PROPORTIONAL_INSIDE, AlignMode.CENTER, AlignMode.CENTER);
    
    stage.addEventListener(Event.RESIZE, onStageResize);
    
    function onStageResize(e:Event):void 
    {
    autoFitArea.width = stage.stageWidth;
    autoFitArea.height = stage.stageHeight;
    
    autoFitArea.x = stage.stageWidth/2 - autoFitArea.width/2;
    autoFitArea.y = stage.stageHeight/2 - autoFitArea.height/2;
    }

    any ideas are much appreciated

×