这两天做了个小东西,在FLEX中嵌入一个网页,因为格式比较复杂,所以简单使用HTML标记无法完成,于是想到用iFrame加载网页,效果还不错,唯一让人感到头痛的就是在iFrame失去焦点时会闪动,这样看起来很不舒服。
但除了iFrame好像没有其它方法可以加载网页了(呵呵,可能是我学疏才浅,请知道评论中指点下 ),必须解决闪动的问题,百度、谷歌不停的变换关键字进行查找方法,发现很多人都碰到这个问题,有些在报怨这个BUG至今没有解决,有些则提到了一些解决方法。总结下来主要还是让FLASH透明,闪动问题是解决了,新的问题又出来了就是FLASH上的输入框都无法输入了。然后又去找透明后无法输入的解决方法,八仙过海,怎么做的都有但都不尽人意。
无意中发现,其实不设置透明也可以解决iFrame的闪动问题
HTML模板修改如下:
<body scroll="no">
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if ( hasProductInstall && !hasRequestedVersion ) {
// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer",
"wmode","opaque"
);
} else if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "${swf}",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer",
"wmode","opaque"
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="${application}" width="${width}" height="${height}"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="${swf}.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
width="${width}" height="${height}" name="${application}" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
"wmode","opaque"
</embed>
</object>
</noscript>
</body>
需要强调的是,这种方法只在IE下测试可以,其它浏览器下没测试过,因为有些人碰到在FF下无法输入中文,但我的程序只能输入数字,所以没有在其它浏览器下测试中文或字符可不可以输入(数字在FF下可以输入,已测试)。