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?
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.
Copy link to clipboard
Copied
Except that that doesn't work either:
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.
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?
Copy link to clipboard
Copied
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