100% 至 100% Flex 应用程序预加载器定位
我在尝试将加载动画应用到我的 Flex 应用程序(整个浏览器窗口占用者)时遇到问题。 我按照 Adobe 的 文章中所述对 DownloadProgressBar 类进行子类化< /a> 关于这个。 基类报告的 stageHeight
和 stageWidth
不正确。 它在构造函数中表示 500x375 像素,在其他地方表示 0x0。 为什么?
I've got a problem trying to apply a loading animation to my Flex application - a whole browser window occupant.
I'm subclassing DownloadProgressBar class as described on Adobe's article about this. stageHeight
and stageWidth
, reported by base class are incorrect. It says 500x375 pixels in constructor and 0x0 elsewhere. Why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
你解决这个问题了吗? 我的 Flex 应用程序也有同样的问题。
舞台返回 500x375。
我的解决方法并不漂亮。 该函数在 FlexEvent.INIT_PROGRESS 上调用。 因此,当我的应用程序可用时,我会使用它的 props。
Have you solved this problem? I have the same problem with my flex app.
Stage returns 500x375.
My workaround is not pretty. This function is called on FlexEvent.INIT_PROGRESS. So when my application is available i use its props.
我不确定这是否有帮助,但我认为可以通过使用 Application.width、Application.height 来引用 Flex 应用程序的大小。
http://livedocs.adobe.com/flex/ 3/html/help.html?content=app_container_2.html
以下问题似乎与您的问题相关:
http://www.nabble.com/Stupid-Question---Flex-width-and-height-td21423345.html
< a href="http://www.nabble.com/Flex-stage-size-td20167125.html" rel="nofollow noreferrer">http://www.nabble.com/Flex-stage-size-td20167125.html
http://dreamweaverforum.info/flex/125327-referencing- stage-flex.html
希望他们有所帮助。
I'm not sure if this will help but I think its possible to reference the size of the Flex application by using Application.width, Application.height.
http://livedocs.adobe.com/flex/3/html/help.html?content=app_container_2.html
The issues below seem to be related to your issue:
http://www.nabble.com/Stupid-Question---Flex-width-and-height-td21423345.html
http://www.nabble.com/Flex-stage-size-td20167125.html
http://dreamweaverforum.info/flex/125327-referencing-stage-flex.html
Hope they help.
0x0 的宽度/高度测量通常表示相关组件在读取时尚未完全布局(包括子组件)。 在构造函数中检查测量结果肯定还为时过早。 在将舞台设置为全屏并且显示的所有内容都已布置好之后,您可能需要检查测量值,可能是在应用程序创建完成事件中,甚至可能更晚。 以下链接应该是一个很好的资源:
http: //blog.flexexamples.com/2007/08/07/creating-full-screen-flex-applications/
A width/height measurement of 0x0 is often indicative of the component in question not having been fully laid out at the time of the reading (including child components). Checking measurements in the constructor is surely too early. You'll want to check the measurements after you've set the stage to fullscreen and everything you're displaying has been laid out, probably at the applications creationComplete event, perhaps even later. The following link should be a good resource:
http://blog.flexexamples.com/2007/08/07/creating-full-screen-flex-applications/
您想要做的是将事件侦听器添加到舞台中以获取其调整大小事件,并相应地调整预加载器的大小。 否则,如果有人在显示预加载器时调整您的 Flex 应用程序的大小,则该应用程序不会调整大小。
或者,您可以使用如下代码将预加载器置于舞台中央:
What you want to do is add an event listener to the stage for its resize event and adjust the size of your preloader accordingly. Otherwise if someone resizes your Flex app while the preloader is displayed it will not resize.
Or alternatively you can center your preloader on the stage using code like so:
我在 flash builder 的 actionscript 项目中使用 100% 到 100% 宽度和高度时遇到了同样的问题。 我观察到 stage.stageWidth 和 stage.stageHeight 为 500x375,直到预加载器加载主类后,它才会更改为全屏尺寸。 因此,预加载器中的项目定位不正确。 我发现我的主类中的这一行正在更新舞台大小:
以下是我在预加载器中实现它的方法:
I had this same problem in an actionscript project in flash builder, using 100% to 100% width and height. I observed that stage.stageWidth and stage.stageHeight was 500x375 until after the preloader had loaded the main class, then it would change to the full screen size. Because of this, the positioning of items in the preloader was incorrect. I discovered that it was this line in my main class that was getting the stage size to update:
Here is how I implemented it in my preloader: