全屏居中 AIR 应用程序

发布于 2024-10-03 15:42:23 字数 854 浏览 8 评论 0原文


我有一个在 AIR /AS 3.0 中开发的应用程序..
我想全屏运行应用程序,所有内容都集中在窗口中。 我尝试全屏显示,

stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE  

但结果发现我的所有组件都没有根据需要在屏幕上居中(全屏时),并且它们被切断或超出屏幕。 基本上,该应用程序是以大约 1024x768 的较低分辨率开发的...但现在它需要全屏运行。此外,应用程序在运行时加载各种模块,它们似乎也没有以全屏居中。当应用程序退出全屏时,它还会显示应用程序窗口的滚动条。

编辑:添加代码:

<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
          layout="absolute" width="1024" height="768">

     <Application:ApplicationStartContainer id="aps" width="100%" height="100%">

               <mx:ModuleLoader id="moduleLoader"/>    

     </Application:ApplicationStartContainer>            

</mx:WindowedApplication>

启动时,应用程序进入全屏,模块加载器加载模块/swfs
大小为 1024*768,但当前所有加载的模块都对齐到 x=0 且 y=0。

有什么想法吗?

谢谢大家。

I have a application developed in AIR /AS 3.0..
i want to run the application in full screen with all the content centered in the window.
i tried to do fullscreen with

stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE  

but turned out all my components dont get centered on the screen as needed(when in full screen) and they get cutoff or they are off screen.
Basically the application was developed in lower resolution about 1024x768...but now it needs to run full screen.Also the application loads various modules at runtime they also dont appear to be centered in fullscreen.When the application comes out of fullscreen it also shows scrollbars for the application window..

Edit :Code added :

<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
          layout="absolute" width="1024" height="768">

     <Application:ApplicationStartContainer id="aps" width="100%" height="100%">

               <mx:ModuleLoader id="moduleLoader"/>    

     </Application:ApplicationStartContainer>            

</mx:WindowedApplication>

On start, the Application goes fullscreen,and the module loader loads modules/swfs
that are of size 1024*768 ,but currently all loaded modules get aligned to
x=0 and y=0.

Any ideas?

Thanks all.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾城泪 2024-10-10 15:42:23

将所有显示对象布局在显示对象容器中 - 作为新精灵的子级,并侦听全屏事件以使显示对象容器居中。

stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenEventHandler);

//assuming the registration point of 'container' is top-left
function fullScreenEventHandler(evt:FullScreenEvent):void
     {
     container.x = stage.stageWidth / 2 - container.width / 2;
     container.y = stage.stageHeight / 2 - container.height / 2;
     }

请注意,进入和离开全屏模式时都会调度全屏事件。

layout all of your display objects in a display object container - as children of a new sprite, and listen for a full screen event to center the display object container.

stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenEventHandler);

//assuming the registration point of 'container' is top-left
function fullScreenEventHandler(evt:FullScreenEvent):void
     {
     container.x = stage.stageWidth / 2 - container.width / 2;
     container.y = stage.stageHeight / 2 - container.height / 2;
     }

note that the full screen event is dispatched when both entering and leaving full screen mode.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文