# MultiResolution App

**URL:** <https://forum.kirupa.com/t/multiresolution-app/329935>\
**Category:** flash\
**Created:** [November 9, 2012, 9:07pm UTC](https://forum.kirupa.com/t/multiresolution-app/329935 "2012-11-09T21:07:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![feap](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@feap](https://forum.kirupa.com/u/feap)\
**Post date:** [November 9, 2012, 9:07pm UTC](https://forum.kirupa.com/t/multiresolution-app/329935/1 "2012-11-09T21:07:14Z")

</div>

Hi guys,  
This is my first thread on [kirupa.com](http://kirupa.com) and i would like to thank to everyone contributing to that great forum.

Im working on a multidevice supported (multiresolution) project, however, changing the stage’s width and height properties on fly is not a supported feature of FlashPlayer if im not wrong. Therefore, the best solution could be to release several versions of your application for several range of devices. And not to dig in bunch of lines of code, u would hold static variables of the stage’s width and height, maybe in an enum class. And releasing would not beyond changing that values and ctrl+enter, viola!

Well, everything was pink until i build&run my project in adl(AIR). SWF metatag was saying 320_480, and adl was set to iPhone predefined device profile, which is of 320_480 as well. Most probably, with an adl device profile, metatag is ignored.

Anyway, as an AIR procedure, resizeEvent dispatced twice behind scenes, and after instantiating a starling object, twice more.

```auto

private var starling:Starling;
private var resizeTimes:int;
 
public function cmFormal():void
{
    stage.scaleMode = "noScale";
    stage.align = "TL";
    stage.mouseChildren = false;
 
    stage.addEventListener("resize", stgResizeHandler, false, int.MAX_VALUE, true);
    stage.addEventListener("deactivate", stgDeactivateHandler, false, 0, true);
}
 
private function stgResizeHandler(e:Event):void
{
    ++resizeTimes;
 
    if (resizeTimes == 2)
    {
        cmStarling = new Starling(cmMain, stage);
        cmStarling.showStats = true;
        cmStarling.enableErrorChecking = false;
        cmStarling.antiAliasing = 0;
        cmStarling.start();
    }
 
    if (resizeTimes == 4) {
 
        if (stage.orientation == "rotatedRight")
        {
            Enum.STG_W = Math.max(stage.stageWidth , stage.stageHeight);
            Enum.STG_H = Math.min(stage.stageWidth , stage.stageHeight);
        }
        else
        {
            Enum.STG_H = Math.max(stage.stageWidth , stage.stageHeight);
            Enum.STG_W = Math.min(stage.stageWidth , stage.stageHeight);
        }
 
        cmStarling.stage.stageWidth = Enum.STG_W;
        cmStarling.stage.stageHeight = Enum.STG_H;
 
        var viewPort:Rectangle = cmStarling.viewPort;
        viewPort.width = Enum.STG_W;
        viewPort. height = Enum.STG_H;
    }
}
 
  ///////////////////
 //application.xml//
///////////////////

/*
  <initialWindow>
    <visible>true</visible>
    <fullScreen>false</fullScreen>
    <autoOrients>false</autoOrients>
    <aspectRatio>landscape</aspectRatio>
    <renderMode>direct</renderMode>
    <systemChrome>standard</systemChrome>
    <resizable>false</resizable>
    <transparent>false</transparent>
    <minimizable>false</minimizable>
    <maximizable>false</maximizable>
  </initialWindow>
*/

```

WHAT I WANT TO KNOW:

- After the latest(4th) ResizeEvent dispatced, the real/corrected values of STG\_W and STG\_H were 300\*480, why, how to tackle?

- How would you get corrected vals of STG\_W and STG\_H before an starling instantiation? because im holding these to use in my project, to get correct vals, i need to instantiate an Starling object. ![](http://forum.kirupa.com/uploads/kirupa/6643/113c347d27d5cf7e.gif)

AIR 3.5 | FP 11.5 | FD4.0.4RTM | The latest Starling frm GitHub
