【问题标题】:iFrame not loading inside Flex popupiFrame 未在 Flex 弹出窗口中加载
【发布时间】:2013-05-12 02:51:05
【问题描述】:

我正在尝试在 iFrame 中加载 pdf,该 iFrame 在弹出窗口中打开。弹出窗口正在显示,但未加载 pdf。 这是我的代码-Main.mxml

 <![CDATA[
        import mx.controls.Alert;
        import mx.events.FlexEvent;
        import com.google.code.flexiframe.IFrame;
        import mx.managers.PopUpManager;

        protected function dgGrid_itemDoubleClick(event:Event):void {
            var win : Window = new Window();
            PopUpManager.addPopUp(win,this,true);
            PopUpManager.centerPopUp(win);
        } 

现在是 Window.mxml

       <?xml version="1.0" encoding="utf-8"?>
         <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
            layout="vertical" width="742" height="452"
            title="PopUp Window" horizontalAlign="center"
            xmlns:flexiframe="http://code.google.com/p/flex-iframe/"
            xmlns:components="components.*"
            showCloseButton="true"
            close="closeWindow(event);" >

<mx:Script>
    <![CDATA[

        import mx.core.IFlexDisplayObject;
        import mx.events.CloseEvent;
        import mx.managers.PopUpManager;

        private function closeWindow(e:CloseEvent):void {
            PopUpManager.removePopUp(e.target as IFlexDisplayObject);
        }
    ]]>
</mx:Script>
<flexiframe:IFrame id="iframe" source="C:\\test.pdf" 
      backgroundColor="blue" width="100%" height="100%" visible="true"/>

你能建议它有什么问题吗?

【问题讨论】:

  • 你可以使用StageWebView 代替 flex-iframe。
  • 嗨杰森,再次感谢您的回复!我认为 StagewebView 用于 AIR,但我想在 web 项目中使用。有什么建议吗?
  • 对不起,我读错你的标签太快了。同样值得注意的是,这似乎是 Flex 3。
  • 试试source="file://c:\\test.pdf"

标签: actionscript-3 flash apache-flex adobe mxml


【解决方案1】:

您需要转到您的 index.template.html 文件并将以下参数放入您的 SWF:

params.wmode= "opaque";

请注意,尽管此设置可以解决 IFrame 的许多问题,但它确实会导致某些 Flash 版本和浏览器出现性能问题。使用 IFrame 需要您自担风险。

【讨论】:

    猜你喜欢
    • 2012-03-02
    • 2015-08-13
    • 2014-09-20
    • 1970-01-01
    • 1970-01-01
    • 2012-01-17
    • 1970-01-01
    • 2013-05-03
    • 1970-01-01
    相关资源
    最近更新 更多