如何在Flex頁面中實現HTML裡面的IFrame功能,下面有個很簡單的方法。
步驟:
1、在此連結中下載現成的資料 https://github.com/flex-users/flex-iframe/downloads
我下的是最新的 flex-iframe-1.5.1.zip
解壓後,在 flex-iframe-1.5.1\sources\library\flex-iframe\src\com\google\code\flexiframe 這個路徑中可以找到兩個AcriptScript 類檔案
2、將IFrame.as、IFrameExternalCalls.as 存放在Flex項目中,我將它複製到Class檔案裡
3、建立立 MXML應用程式,添加紅色部分代碼即可, source裡填充要顯示的頁面
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:flexiframe="http://code.google.com/p/flex-iframe/"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
xmlns:iframe="Class.*">
<fx:Declarations>
<!-- 將非可視元素(例如服務、值對象)放在此處 -->
</fx:Declarations>
<iframe:IFrame id="iFrame" source="http://www.baidu.com/" width="100%" height="100%"/>
</s:Application>
相關文章:http://hi.baidu.com/%D5%D4%B9%A7%DC%F8/blog/item/3c15728f0b5a22709e2fb4d1.html