功能描述:在Flex中嵌套框架,并且进行数值传递
1、编辑Flex框架组件iFrame.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
resize="callLater(moveIFrame)"
move="callLater(moveIFrame)">
<mx:Script>
<![CDATA[
import flash.external.ExternalInterface;
import flash.geom.Point;
import flash.net.navigateToURL;
private var __source: String;
/**
* Move iframe through ExternalInterface. The location is determined using localToGlobal()
* on a Point in the Canvas.
**/
private function moveIFrame(): void
{
var localPt:Point = new Point(0, 0);
var globalPt:Point = this.localToGlobal(localPt);
ExternalInterface.call("moveIFrame", globalPt.x, globalPt.y, this.width, this.height);
}
/**
* The source URL for the IFrame. When set, the URL is loaded through ExternalInterface.
**/
public function set source(source: String): void
{
if (source)
{
if (! ExternalInterface.available)
{
throw new Error("ExternalInterface is not available in this container. Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime are required.");
}
__source = source;
ExternalInterface.call("loadIFrame", source);
moveIFrame();
}
}
public function get source(): String
{
return __source;
}
/**
* Whether the IFrame is visible.
**/
override public function set visible(visible: Boolean): void
{
super.visible=visible;
if (visible)
{
ExternalInterface.call("showIFrame");
}
else
{
ExternalInterface.call("hideIFrame");
}
}
]]>
</mx:Script>
</mx:Canvas>
2、放置到要使用框架的Flex中index.mxml,并写入引用哪个frame.html
<ui:IFrame id="iFrame" source="frame.html" visible="true" width="100%" height="300"/>
3、在引用框架的Flex生成页index.html里加入:
<1. wmode set to opaque
在调用swf的后面加上"wmode","opaque"
例如:"pluginspage", "http://www.adobe.com/go/getflashplayer",
"wmode","opaque"
<2. the moveIFrame,hideIFrame,showIFrame,loadIFrame methods
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 28;
// -----------------------------------------------------------------------------
// -->
function moveIFrame(x,y,w,h) {
var frameRef=document.getElementById("myFrame");
frameRef.style.left=x;
frameRef.style.top=y;
var iFrameRef=document.getElementById("myIFrame");
iFrameRef.width=w;
iFrameRef.height=h;
}
function hideIFrame(){
document.getElementById("myFrame").style.visibility="hidden";
}
function showIFrame(){
document.getElementById("myFrame").style.visibility="visible";
}
function loadIFrame(url){
document.getElementById("myFrame").innerHTML = "<iframe id='myIFrame' src='" + url + "'frameborder='0'></iframe>";
}
//要调用的内容,加载前三个就可以了,后面这个函数是用来调用返回值
function getEditorText(){
return document.getElementById("myIFrame").contentWindow.GetEditorText1();
}
</script>
<3. the 'myFrame' div
在</body>这前写入:
<div id="myFrame" style="position:absolute;background-color:transparent;border:0 px;visibility:hidden;"></div>
4、在Flex页面index.mxml输入的函数值,调用index.html中的'getEditorText'函数,并且写入到text1.text中
text1.text=ExternalInterface.call('getEditorText',param1,param2,param3,...)
getEditorText:函数名称
param:参数值
5、在生成页中取得框架中的函数
框架内的frame.html,放置在head之间:
function GetEditorText1(){
return getHTML(params);
index.html生成页的调用,设置在head之间:
function getEditorText(){
return document.getElementById("myIFrame").contentWindow.GetEditorText1();
}
后记:实际中在这里只是调用一个层放在对应位置而已,当我们在Flex中做申缩动作时,层也要跟着改变,我是如此处理的:
设置move或show事件,当move或show时则调用:iFrame.source = "frame.html"
参考:
http://www.cnflex.cn/html/mxml/20070321/95.html
http://www.cnblogs.com/dannyr/archive/2004/11/24/68026.aspx
http://renaun.com/flex2/posts/flexsearch/index.html(有源码下载)
分享到:
相关推荐
将项目下载到本地后,把ZZFLEX拖入到你的项目中,即可正常使用。 2、CocoaPods方式 pod 'ZZFLEX', :git => 'https://github.com/tbl00c/ZZFLEX.git' 功能模块 目前ZZFLEX主要包含以下6个功能模块: 一、Foundation...
高仿微信,iOSAppTemplate代码重构。此版本TLChat基于TLKit、 ZZFLEX实现
ZZFLEX主要包含两大部分: 1、为常用控件增加了链式API拓展,可以任性的点点点了 UIButton *butt 0, 100, 35)).title(@"hello").titleColor([UIColor blackColor]).cornerRadius(3.0f).view; 2、数据驱动的列表页...
base zz zz zz zz zz base zz zz zz zz zz base zz zz zz zz zz base zz zz zz zz zz
有两种方式注册组件: 一种是调用regsvr32.exe: ... 逆@风@者 另外一种是在MTS(微软...1、动态卸载平衡,提高组件和基于组件的应用程序的升级性。 2、包含公布和提交事件和队列组件的能力,使得更容易与多个组件联合。
ZZ561401.CAB ZZ561401.CAB ZZ561401.CAB
详细描述flex和MyEclipse的整合
使用LoopSim方法,我们合并ZZ和ZZ + jet的NLO QCD结果,并获得ZZ产生的近似NNLO预测。 还包括对ZZ过程的精确胶子融合环平方的贡献。 最重要的是,我们将来自胶子-胶子通道的胶子-融合ZZ + jet贡献添加到我们的合并...
wincc SIMATIC WinCC是第一个使用最新的32位技术的过程监视系统,具有良好的开放性和灵活性。 从面市伊始,用户就对SIMATIC WinCC印象深刻。
Vizzuality组件是我们在项目中使用的React组件的集合。 组件 :带有控件,缩放和动画的3D地球。 它使用WebGL和three.js。 :Spinner是一个可以旋转的图标。 如何使用 您需要先配置nodejs和npm,然后才能使用以下...
在CAD中想要快速测量长度,在CAD工具栏找到加载应用程序,再点击加载 加载成功后在输入栏输入“zz”(不分大小写)在选择你需要测量的线段即可。
质子-质子碰撞中的四轻子产生,pp→(Z /γ⁎)(Z /γ⁎)→ℓ+ℓ-ℓ′+ ℓ′-,其中ℓ,ℓ′= e或μ,在 大型强子对撞机的CMS检测器的质心能量为13 TeV。 数据样本对应于2.6 fb $ ^ {-1} $的综合亮度。 对于具有两...
通过JS实现在页面分页. <script> var a = document.getElementById("all").getElementsByTagName("div"); var zz =new Array(a.length); for(var i=0;i ;i++){ zz[i]=a[i].innerHTML; } //div的字符串数组付给zz...
博文链接:https://lkfnn.iteye.com/blog/33600
,主图指标,顶底信号,突破,转折信号,都很明显
针对ZZ8500/20/40型液压支架中缸筒设计不合理部分进行改进。分别列举了中缸筒按原设计和改进后设计进行加工的工艺过程,并对二者进行了比较。改进前设计加工工艺繁琐,费料费时,效率低;改进后省工省料,可降低成本,提高...
写中文文章,或者外文,参考文献格式。例如:[1] Niu M, Hu Y, Sun S, et al. A novel hybrid decomposition-ensemble model based on VMD and HGWO for container throughput forecasting[J]. Applied Mathematical...
程序员的编辑器——VIM(zz) - 饮水思源
留言本改自柏图留言本 BTB 1.2 管理员:zz809 密 码:zz809.com