屏幕分辨率太小时如何缩放Flex应用程序?
我正在开发一个 Flex 应用程序,专为 1280x1024 及更高的屏幕分辨率而设计。在使用投影仪的极少数情况下(通常最大为 1024x768 像素),我想缩小应用程序(目前我有很多滚动条和剪辑)。
我已经尝试过应用程序的属性 scaleX
和 scaleY
以及 stage.scaleMode
。 我无法完全找到一种在不缩放的情况下渲染应用程序的方法。
- 但是,当应用程序的宽度和高度大于某些值时,
- 当宽度或高度小于某些值时,
我该如何实现这一点?
I'm developing a Flex application that is designed for screen resolutions of 1280x1024 and more. In the rare case that a projector is used (which usually has a maximum of 1024x768 pixels) I'd like to scale down the application (currently I get lots of scrollbars and clipping).
I've already experimented with the application's properties scaleX
and scaleY
as well as stage.scaleMode
. However, I couldn't quite figure out a way to
- render the application without scaling when the application's width and height are larger than certain values
- use scaling when the width or height are smaller than certain values
How can I accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我终于找到了一种缩小应用程序规模的方法。事实上,孩子们需要扩展的应用程序。否则应用程序的
宽度
和高度
会缩小。由于我使用的是状态,因此我还必须为
currentStateChanging
事件添加一个事件处理程序。I finally figured out a way to scale down the application. Actually, the applications children need to scale. Otherwise the
width
andheight
of the application shrinks.Since I'm using states I had to add an event handler for the
currentStateChanging
event too.为了扩展整个应用程序,而不是单独扩展所有元素,我删除了循环并添加了:
To scale the application as a whole, and not all the elements separately, I removed the loop and added instead:
Alex Harui 在 2009 年提出了一个很好的解决方案。请参阅 ScaleMode 自动缩放应用程序。请参阅此处示例,了解其工作原理。
A nice solution was presented back in 2009 by Alex Harui. See ScaleMode to scale application automatically. See example here how it works.
我将通过向顶级应用程序上的“调整大小”事件添加事件侦听器来解决此问题。下面是调整大小事件的示例方法处理程序(假设处理程序位于主 Application 类中,因此“this”指的是顶级应用程序):
I'd tackle this by adding an event listener to the "resize" event on the top level application. Here's an example method handler for the resize event (assumes the handler is in the main Application class, so "this" refers to the top level Application):