• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Wrong stage size on MBP Retina

Explorer ,
Dec 30, 2013 Dec 30, 2013

Copy link to clipboard

Copied

Hi, i'm not sure if it's a bug or i'm doing something wrong, but i don't get the right stage bounds on my Macbook Pro Retina.

I already set <requestedDisplayResolution>high</requestedDisplayResolution> inside the  initialWindow tag, but stage.fullScreenWidth returns always 1440 instead of 2880 and stage.stageWidth returns wrong values also.

I made tests with AIR SDKs 3.7, 3.8, 3.9 and 4.0, but no one worked for me.
Am i overlooking something?

Here's the code i'm using:

package
{
     import flash.display.Sprite;
     import flash.display.StageAlign;
     import flash.display.StageScaleMode;
     import flash.events.Event;
     import flash.text.TextField;
     import flash.text.TextFormat;

     public class Test extends Sprite
     {
          private var console : TextField;
          public function Test()
          {
               stage.scaleMode = StageScaleMode.NO_SCALE;
               stage.align = StageAlign.TOP_LEFT;
               stage.addEventListener(Event.RESIZE, onStageResize);
               
               console = new TextField();
               console.defaultTextFormat = new TextFormat("_sans", 12);
               console.width = stage.stageWidth;
               console.height = stage.stageHeight;
               console.wordWrap = true;
               console.multiline = true;
               addChild(console);
          }

          private function onStageResize(event : Event) : void
          {
               output("***********************************************");
               output('stage.contentsScaleFactor: ' + (stage.contentsScaleFactor));
               output('stage.stageWidth: ' + (stage.stageWidth));
               output('stage.stageHeight: ' + (stage.stageHeight));
               output('stage.fullScreenWidth: ' + (stage.fullScreenWidth));
               output('stage.fullScreenHeight: ' + (stage.fullScreenHeight));
               
               console.width = stage.stageWidth;
               console.height = stage.stageHeight;
          }

          private function output(... $text) : void
          {
               var text:String = $text.join(", ");
               console.appendText(text+"\n");
               trace(text);
          }
     }
}

Thanks in advance,
Solano

TOPICS
Development

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jan 01, 2014 Jan 01, 2014

I believe this is the expected behavior on the native stage. Even when running on a retina device with requestedDisplayResolution set to high, the native stage uses the same coordinate system as the non-retina version, and stageWidth and stageHeight are reported with the same units, as mentioned in the docs for contentsScaleFactor:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Stage.html#contentsScaleFactor

You could query the value of contentsScaleFactor to know

...

Votes

Translate

Translate
Engaged ,
Jan 01, 2014 Jan 01, 2014

Copy link to clipboard

Copied

I believe this is the expected behavior on the native stage. Even when running on a retina device with requestedDisplayResolution set to high, the native stage uses the same coordinate system as the non-retina version, and stageWidth and stageHeight are reported with the same units, as mentioned in the docs for contentsScaleFactor:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Stage.html#contents...

You could query the value of contentsScaleFactor to know if running in retina mode or not.

The native stage coordinates stay the same, but if you are using Stage3D in your app, the higher res back buffer is created with another additonal argument to configureBackBuffer():

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display3D/Context3D.html#co...

and in this case the raw pixel dimensions would be double in size.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 02, 2014 Jan 02, 2014

Copy link to clipboard

Copied

Thank you Jeffrey for your help. Actually you helped me a lot inderectly with your posts in the Starling forum.

If I have understood correctly, I can reproduce in Stage3D a highres image but not target every single pixel.

So when I display an image with a width of 200px and want to align another image on the right side, I have to align the second image with x = 100? This is really confusing.

Will do some tests now and come back here. What I've noticed, is that it doesn't matter if I set the flag requestedDisplayResolution to high or not. The conentScaleFactor will return always 2. I'm wondering for what we have this flag.

Best Regards and a happy new Year,

Solano

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 02, 2014 Jan 02, 2014

Copy link to clipboard

Copied

Ok, I got it now. I was confused, because all images were scaled up, although I used the scale factor 1. Since Flash wont work with the real bounds, all textures have to be scaled down. And this did the trick.

Thank you very much Jeffrey

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 02, 2014 Jan 02, 2014

Copy link to clipboard

Copied

Ok, great to hear you were able to resolve this. 

When you mentioned:

"I've noticed, is that it doesn't matter if I set the flag requestedDisplayResolution to high or not. The conentScaleFactor will return always 2"

I was a bit surprised as I wouldn't have expected this.

You did say 'contentScaleFactor' and not contentsScaleFactor (with an extra 's'). This can be confusing because Starling has a different contentScaleFactor regarding the scaling mode of the Stage3D contents and textures, while the linked to contentsScaleFactor I mentioned above is  for the native stage.

(It wasn't clear from your comment whether you were reporting contentScaleFactor or contentsScaleFactor values)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 02, 2014 Jan 02, 2014

Copy link to clipboard

Copied

LATEST

Ups, this was a typo. I meant contentsScaleFactor with 's'. And the value is in fact always 2. It doesn't matter if I set requestedDisplayResolution to high or standard. For what is the flag requestedDisplayResolution intended?

From the docs: "...When set to high, the application can address each high-resolution pixel..."

But I can't address each pixel, since the stage size will never be 2880pixels width. This is very confusing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines