濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > 在Flex(Flash)中嵌入HTML代碼或頁(yè)面(Flex IFrame)

在Flex(Flash)中嵌入HTML代碼或頁(yè)面(Flex IFrame)

熱門(mén)標(biāo)簽:外呼系統(tǒng)號(hào)碼顯示 廣州ai外呼系統(tǒng)業(yè)務(wù) 車載電話機(jī)器人 什么行業(yè)需要電話機(jī)器人 中山外呼系統(tǒng)中間件 地圖標(biāo)注多家店 南昌crm外呼系統(tǒng)如何 天津企業(yè)外呼系統(tǒng)代理商 無(wú)錫電銷外呼系統(tǒng)代理

在flex組件中嵌入html代碼,可以利用flex iframe。這個(gè)在很多時(shí)候會(huì)用到的,有時(shí)候flex必須得這樣做,如果你不這樣做還真不行……

flex而且可以和html進(jìn)行JavaScript交互操作,flex調(diào)用到html中的JavaScript方法以及獲取調(diào)用后的返回值。

1、flex iframe下載地址:https://github.com/downloads/flex-users/flex-iframe/flex-iframe-1.5.1.zip

下載完成后目錄如下
 
asdoc就是文檔doc了
bin有需要用到的flex庫(kù) swc
examples就是示例
sources源代碼

2、將bin目錄中的swc引入到你的flex工程中,并加入代碼片段如下

復(fù)制代碼 代碼如下:

?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 {
// 調(diào)用當(dāng)前iframe嵌入頁(yè)面中的sayHello 的JavaScript方法
iFrameBySource.callIFrameFunction("sayHello");
}

protected function sayHandler(event:MouseEvent):void {
// 調(diào)用當(dāng)前iframe嵌入頁(yè)面中的say的JavaScript方法,并傳入一個(gè)參數(shù)
iFrameBySource.callIFrameFunction("say", ["hello world!"]);
}
protected function sayHiHandler(event:MouseEvent):void {
// 調(diào)用當(dāng)前iframe嵌入頁(yè)面中的sayHi的JavaScript方法,并傳入2個(gè)參數(shù)。sayHi方法會(huì)返回一個(gè)字符串,最后一個(gè)回調(diào)就是輸出值的函數(shù)
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 target="_top">Christophe Coenraets/a>/li>
li>a target="_top">Brian Deitte/a>/li>
/ul>
/body>
/html>
]]>
/mx:String>

mx:Panel width="80%" height="80%" title="使用source本地遠(yuǎn)程頁(yè)面">
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加載遠(yuǎn)程頁(yè)面">
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文本內(nèi)容">
flexiframe:IFrame id="iFrameByContent" width="100%" height="100%" content="{iFrameHTMLContent}"/>
/mx:Panel>

/mx:Application>

frame.html 頁(yè)面內(nèi)容
復(fù)制代碼 代碼如下:

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
html>
head>
title>frame.html/title>
meta http-equiv="pragma" content="no-cache">
meta http-equiv="cache-control" content="no-cache">
meta http-equiv="expires" content="0">
script type="text/javascript">
// 無(wú)參數(shù)
function sayHello() {
alert("hello......");
}

// 1個(gè)參數(shù)
function say(message) {
alert("your say: " + message);
}

// 多個(gè)參數(shù) 并返回值
function sayHi(message, name) {
alert("your say: " + message + ", name: " + name);
return "your say: " + message + ", name: " + name;
}
/script>

/head>

body>
flex frame example html page!
input type="button" value="say" onclick="sayHello()"/>
/body>
/html>

要注意的是:你的flex項(xiàng)目工程需要發(fā)表到http的應(yīng)用服務(wù)器(如tomcat、jboss、iis)這些服務(wù)器中,用http請(qǐng)求方式才能調(diào)用到頁(yè)面內(nèi)容和JavaScript方法。如果不發(fā)布到應(yīng)用服務(wù)器中,那樣只能在iframe中嵌套遠(yuǎn)程的http請(qǐng)求的頁(yè)面,本地靜態(tài)頁(yè)面是無(wú)法顯示的。

您可能感興趣的文章:
  • Vue 使用iframe引用html頁(yè)面實(shí)現(xiàn)vue和html頁(yè)面方法的調(diào)用操作
  • Html中 IFrame的用法及注意點(diǎn)
  • html判斷當(dāng)前頁(yè)面是否在iframe中的實(shí)例
  • js取得html iframe中的元素和變量值
  • 設(shè)置iframe的document.designMode后僅Firefox中其body.innerHTML為br
  • js中訪問(wèn)html中iframe的文檔對(duì)象的代碼[IE6,IE7,IE8,FF]
  • 讓iframe自適應(yīng)高度(支持XHTML,支持FF)
  • 讓iframe自適應(yīng)高度(支持xhtml)IE firefox兼容
  • HTML iframe標(biāo)簽用法案例詳解

標(biāo)簽:滄州 海西 泰州 仙桃 欽州 呂梁 佛山 攀枝花

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《在Flex(Flash)中嵌入HTML代碼或頁(yè)面(Flex IFrame)》,本文關(guān)鍵詞  在,Flex,Flash,中,嵌入,HTML,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《在Flex(Flash)中嵌入HTML代碼或頁(yè)面(Flex IFrame)》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于在Flex(Flash)中嵌入HTML代碼或頁(yè)面(Flex IFrame)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    都江堰市| 广州市| 开原市| 桃源县| 湖口县| 兖州市| 丽江市| 东乡县| 宁晋县| 贵定县| 昌平区| 平山县| 中山市| 瑞安市| 西充县| 浦江县| 衡水市| 葫芦岛市| 霍州市| 勃利县| 南召县| 江津市| 常宁市| 乐至县| 探索| 乾安县| 鹤庆县| 道孚县| 吉水县| 宁武县| 元阳县| 五莲县| 望都县| 恩平市| 乌恰县| 兴山县| 宣化县| 商城县| 松潘县| 黑水县| 天水市|