PDF 在 Flex mx 中正确显示的问题:Windows/Reader X 中的 HTML 控件
我在 Flex 中的 mx:HTML 控件的可视区域之外显示 PDF 时遇到问题。当应用程序启动时 - mx:HTML 设置为一定大小,但如果应用程序最大化,则可以放大。复制它的条件如下:
- 问题仅发生在 Windows 中(Windows 7,不在 Mac 上)
- 问题仅发生在安装了 Reader X 的情况下(不适用于以前的版本)
- 问题仅发生在运行构建的应用程序时,不会发生在调试/ FlashBuilder 的开发模式
下面是一些重现该问题的代码。组内的组看起来有点混乱,但我们的应用程序中还有其他内容,我已经删除了这些内容,只是为了有一个小型测试应用程序来重现该问题:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="1004" height="510" backgroundColor="#000000" >
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function press_clickHandler():void
{
htmlContent.location = "vt1_04_using_flash_builder.pdf";
}
]]>
</fx:Script>
<fx:DesignLayer>
<mx:HDividedBox id="myDividedBox" left="10" right="5" top="39" bottom="61" liveDragging="false">
<mx:Panel id="pnlTreeCtrl" width="250" height="100%" headerHeight="0">
<s:Button id="press" buttonMode="true" click="press_clickHandler()"
right="84" top="8" label="Press"/>
</mx:Panel>
<s:Group id="groupCourseMain" height="100%" >
<s:Group id="groupCourseHTML" right="0" top="30" bottom="0" width="100%">
<mx:HTML id="htmlContent" top="0" bottom="0" width="100%" />
</s:Group>
</s:Group>
</mx:HDividedBox>
</fx:DesignLayer>
</s:WindowedApplication>
编辑:红色箭头显示阅读器中浮动灰色条的位置X 出现在可视区域之外:
I'm having an issue with the PDF displaying outside the viewable area of the mx:HTML control in Flex. When the application starts up - the mx:HTML is set to a certain size, but can be enlarged if the application is maximized. These are the following conditions to replicate it:
- Issue only happens in Windows (Windows 7, not on Mac)
- Issue only happens with Reader X installed (not with previous versions)
- Issue only happens when running the built app, does not happen in debug / development mode from FlashBuilder
Here is some code to reproduce the issue. It looks a bit messy with the groups within groups, but there is other stuff in our application that I've stripped out just to have a small test app to reproduce the issue:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="1004" height="510" backgroundColor="#000000" >
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function press_clickHandler():void
{
htmlContent.location = "vt1_04_using_flash_builder.pdf";
}
]]>
</fx:Script>
<fx:DesignLayer>
<mx:HDividedBox id="myDividedBox" left="10" right="5" top="39" bottom="61" liveDragging="false">
<mx:Panel id="pnlTreeCtrl" width="250" height="100%" headerHeight="0">
<s:Button id="press" buttonMode="true" click="press_clickHandler()"
right="84" top="8" label="Press"/>
</mx:Panel>
<s:Group id="groupCourseMain" height="100%" >
<s:Group id="groupCourseHTML" right="0" top="30" bottom="0" width="100%">
<mx:HTML id="htmlContent" top="0" bottom="0" width="100%" />
</s:Group>
</s:Group>
</mx:HDividedBox>
</fx:DesignLayer>
</s:WindowedApplication>
Edit: The red arrow shows where the floating grey bar in Reader X appears outside the viewable area:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是一个已知的bug,没有修复。
解决方法是在加载文档后以及每次调整其父组的大小时重新调整浏览器宽度的大小。诀窍是调整一个像素的大小以强制重绘。下面的代码似乎可以工作。这是我能做的最好的事情,也许还有更好的解决方案。
This seems to be a known bug with no fix.
A workaround is to re-size the browser width after the document is loaded and every time its parent group is re-sized. The trick is to re-size one pixel off to force a redraw. The following code seems to work. That's the best I could do, there may be better solutions.