在Flex(Flash)中嵌入HTML代码或页面(Flex IFrame)
2013-08-15 19:17
645 查看
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:flexiframe="http://code.google.com/p/flex-iframe/" horizontalAlign="center" verticalAlign="middle" xmlns:s="library://ns.adobe.com/flex/spark"> <mx:Script> <![CDATA[ import mx.controls.Alert; protected function sayHelloHandler(event:MouseEvent):void { // 调用当前iframe嵌入页面中的sayHello 的JavaScript方法 iFrameBySource.callIFrameFunction("sayHello"); } protected function sayHandler(event:MouseEvent):void { // 调用当前iframe嵌入页面中的say的JavaScript方法,并传入一个参数 iFrameBySource.callIFrameFunction("say", ["hello world!"]); } protected function sayHiHandler(event:MouseEvent):void { // 调用当前iframe嵌入页面中的sayHi的JavaScript方法,并传入2个参数。sayHi方法会返回一个字符串,最后一个回调就是输出值的函数 iFrameBySource.callIFrameFunction("sayHi", ["hello world", "李四"], function (data:*): void { Alert.show(data); }); } ]]> </mx:Script> <!-- HTML content stored in a String --> <mx:String id="iFrameHTMLContent"> <![CDATA[ <html> <head> <title>About</title> </head> <body> <div>About</div> <p>Simple HTML Test application. This test app loads a page of html locally.</p> <div>Credits</div> <p> </p> <p>IFrame.as is based on the work of</p> <ul> <li><a href="http://coenraets.org/" target="_top">Christophe Coenraets</a></li> <li><a href="http://www.deitte.com/" target="_top">Brian Deitte</a></li> </ul> </body> </html> ]]> </mx:String> <mx:Panel width="80%" height="80%" title="使用source本地远程页面"> <flexiframe:IFrame id="iFrameBySource" width="100%" height="100%" source="frame.html"/> <s:Button label="sayHello" click="sayHelloHandler(event)"/> <s:Button label="say-param" click="sayHandler(event)"/> <s:Button label="sayHi" click="sayHiHandler(event)"/> </mx:Panel> <mx:Panel width="80%" height="80%" title="使用source加载远程页面"> <flexiframe:IFrame id="iFrameByRemoteSource" width="100%" height="100%" source="http://www.baidu.com" visible="true" overlayDetection="true" /> </mx:Panel> <mx:Panel width="80%" height="80%" title="使用content属性 加载本地html文本内容"> <flexiframe:IFrame id="iFrameByContent" width="100%" height="100%" content="{iFrameHTMLContent}"/> </mx:Panel> </mx:Application>
相关文章推荐
- 在Flex (Flash)中嵌入HTML 代码或页面—Flex IFrame
- [Flex] IFrame系列 —— 嵌入本地页面两种方式source和content(html页面和html代码)
- flex通过iframe嵌入完整html页面
- 在HTML页面中嵌入flex(flash),并向flex传参(一)
- 在Flex (Flash)中嵌入HTML 代码或页面—Flex IFrame
- 通过URL获取html代码实现页面嵌入(代替iframe效果)
- flash(flex)中嵌入完整HTML页面
- Flex组件IFrame中嵌入HTML页面的方法
- 在Flex (Flash)中嵌入HTML 代码或页面—Flex IFrame
- [Flex] IFrame系列 —— IFrame嵌入html点击其他组件后页面消失的问题
- 跨域在嵌入页面iframe中设置cookie
- [酷东东] 在Flex里嵌入网页:IFrame 开源类库
- 关于iframe页面嵌入后在ios设备上position=fixed属性失效的解决办法
- IFRAME嵌入页面,只显示中间一部分,其他的都不要
- 在Flex应用中嵌入HTML代码
- Java与Flex学习笔记(20)---将flex页面嵌入到jsp页面中
- 页面嵌入Flex时,JS和AS相互调用(普通嵌入)
- 嵌入页面-IE:Download的使用和iframe的使用
- 页面嵌入iframe高度问题
- SwfObjects在页面中嵌入flash(SWF)