一,弹框设置:
创建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';"
修改为要设置的颜色