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

iPad: Centering the application (StageAlign.TOP_LEFT isn't)

New Here ,
Feb 08, 2012 Feb 08, 2012

Copy link to clipboard

Copied

So I have an application that I want to be full screen and centered.

Most of the codebase is done via Flash Pro and then exported as a swc that's imported into a Mobile Actionscript Project in Flash Builder.

So far, so good.

Here's the constructor for main class of that project:

        public function myApp()

        {

            super();

            stage.align = StageAlign.TOP;

            stage.scaleMode = StageScaleMode.NO_SCALE;

            var t:MovieClip = new Game(stage) as MovieClip;

            addChild(t);

        }

Here's the issue:

Despite the fact that the original stage size is 1024 x 750, I cannot get that object to line up with the borders of the emulated ipad without moving it (e.g. when using left I have to offset it on y by -185 or so pixels).

StageAlign.TOP_LEFT is the closest, but it's about 20 pixels too far "up."  Wherever the application decides that 0,0 is is entirely dependent on what alignment I use.

I can't simply offset the myApp object, nor the Game object, as it completely screws with the X and Y values of some objects (i.e. mouse events as well as localToGlobal).

(Also, I have to set StageScaleMode.NO_SCALE or the application ends up far too LARGE for the ipad's screen, by almost double).

I've also tried some of the settings in the *-app.xml file, to no avail.  In fact, attempting to force a min size equal to the application's actual size causes it to vanish completely and setting an X and Y position appears meaningless.

What gives?

TOPICS
Development

Views

904

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
LEGEND ,
Feb 08, 2012 Feb 08, 2012

Copy link to clipboard

Copied

If you're saying that you want the stage to scale to fit the screen, and be centered, then just take out all of your stage scale and align code. Without any of that in there the stage will scale to just fit inside the screen, and will be centered.

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
New Here ,
Feb 08, 2012 Feb 08, 2012

Copy link to clipboard

Copied

Except that that doesn't work either:

flashbuilder2.png

Note how it's too large (by almost double) and the top edge of the main object is, oh, 185 pixels below the top of the iPad.  Rotating the iPad doesn't solve the issue.

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
LEGEND ,
Feb 08, 2012 Feb 08, 2012

Copy link to clipboard

Copied

To get that screenshot, what remaining scale and align code do you have? What x and y values are you using for the game movieclip?

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
New Here ,
Feb 08, 2012 Feb 08, 2012

Copy link to clipboard

Copied

LATEST

None.  There's no positioning code, no size code, nothing.

          public function myApp()
          {
               super();
               var t:MovieClip = new Game(stage) as MovieClip;
               addChild(t);
} 

The default x and y for attached movieclips is 0,0.  I don't know what the default align and scale mode are.  The *-app.xml file is almost default, I think the only thing I changed was adding the icon (which I'd like to point out, can't be done in Flash Builder: FB doesn't seem to have a way to uncomment lines of XML code...).  Only thing I've changed aside from that would be these, but I don't know what the defaults were at this point.

< autoOrients>true        < fullScreen>true        < visible>true

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