加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex 弹窗口嵌套iframe,移动窗体iframe内容不显示了问题处理

发布时间:2020-12-15 04:05:18 所属栏目:百科 来源:网络整理
导读:一,弹框设置: 创建titlewindow组件内嵌套iframe,名称为UrlForm ?xml version="1.0" encoding="utf-8"? s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" ... close="PopUpManager.removePopUp(this);" initialize="init()"? ?move="titlewindow1_

一,弹框设置:

创建titlewindow组件内嵌套iframe,名称为UrlForm

<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"

...

close="PopUpManager.removePopUp(this);"

initialize="init()"?

?move="titlewindow1_moveHandler(event)">

<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<fx:String id="url"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.core.Container;
import mx.events.MoveEvent;
import mx.managers.PopUpManager;
private function init():void
{
ifra.source =url;
}

//窗体移动时,iframe可以跟着移动。若不加此方法则无法移动iframe,因为iframe是div
protected function titlewindow1_moveHandler(event:MoveEvent):void
{
//标记组件,以便在稍后屏幕更新期间调用该组件的 updateDisplayList() 方法。
ifra.invalidateDisplayList();
}


]]>
</fx:Script>

<flexiframe:IFrame id="ifra" width="850" height="520" horizontalCenter="0" source="" />

</s:TitleWindow>

主窗体调用弹窗体:script代码

var urlF:UrlForm=new UrlForm();

urlF.url="http://www.baidu.com";
//下面的代码可以起到居中弹出的效果;
urlF.x=FlexGlobals.topLevelApplication.stage.stageWidth/2- urlF.width/2; ?
urlF.y=FlexGlobals.topLevelApplication.stage.stageHeight/2- urlF.height/2;

PopUpManager.addPopUp(urlF,map,true); ??
PopUpManager.centerPopUp(urlF);?

二,移动窗体iframe内容不显示了问题处理:

模板index.template.html 中的:

1,script脚本加入

params.wmode = "transparent";

如下:

?var params = {};
? ? ? ? ? ? params.quality = "high";
? ? ? ? ? ? params.bgcolor = "${bgcolor}";
? ? ? ? ? ? params.allowscriptaccess = "sameDomain";
? ? ? ? ? ? params.allowfullscreen = "true";
? ? ? ? ? ? params.wmode = "transparent";

2,<noscript>中加入

<param name="wmode" value="transparent" />

如下:

<object ....

...

<param name="allowFullScreen" value="true" />
<param name="wmode" value="transparent" />

ok,完成


若是要修改iframe的背景色,则需要找到iframe源码中的IFrameExternalCalls.as中的:

"newDiv.style.backgroundColor = '#FFFFFF';" 
修改为要设置的颜色

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读