FLEX 使用iFrame闪动的解决方法
2010-04-09 10:51
323 查看
这两天做了个小东西,在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下可以输入,已测试)。
但除了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下可以输入,已测试)。
相关文章推荐
- 使用jQuery的hover事件在IE中不停闪动的解决方法
- Flex中解决使用TabNavigator控件不能显示Alert.Show()窗体的方法
- 使用jQuery的hover事件在IE中不停闪动的解决方法
- 使用ArcGIS GP服务遇到的问题,原因以及解决方法 - 客户端API开发(Javascript/Flex/Silverlig 转载
- CI框架 不能使用Frameset或Iframe 解决方法 (再创灵活应用新方法)
- 使用jQuery的hover事件在IE中不停闪动的解决方法
- easyUI layout 中使用tabs+iframe解决请求两次方法
- flex 嵌入 iframe 点iframe 外面的区域 iframe会消失。 解决方法
- https页面中使用iframe出现安全警告的解决方法
- 一个页面中使用多个iframe导致在ie中假死问题的解决方法
- Flex与Google Iframe弹出框被Iframe遮盖有关问题解决方法
- Flex开发中使用Ant编译.mxml成.swf后,在.swf里使用Session的解决方法
- easyUI layout 中使用tabs+iframe解决请求两次方法
- jquery hover 不停闪动问题的解决方法(亦为stop()的使用)
- iframe 的缓存文件及解决方法以及 jquery deffered.then() 方法的使用
- Flex使用ant编译的时候无法加载css样式表中的图片解决方法
- 在https页面中使用iframe出现安全警告的解决方法
- Chrome浏览器中使用 iframe 嵌入网页导致视频不能全屏的问题解决方法
- Flex中Module的使用以及内存泄露问题解决方法
- 今天使用ie6访问有iframe页面时,出现cookie被阻挡的问题解决方法