想起之前在ExtJS中就涉及到嵌入网页问题,这次改用Flex肯定也少不了要用这个
这里用的是TAB页面里面嵌入网页,找到一个flex的iframe自定义类,比较好用,请访问http://code.google.com/p/flex-iframe/
首先从上面的网址下载fb3_1_3_2.zip(自己挑版本吧)
解压,找到fb3\HTMLTest\src下面有个IFrame.as拷到自己的Flex工程中去
具体怎么用的,看下代码
- <SPAN style="FONT-SIZE: medium"><?xml version="1.0" encoding="utf-8"?>
- <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:local="*"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="init()">
- <mx:TabNavigator id="tab"
- width="100%"
- height="100%">
- <local:IFrame id="test1"
- label="Google"
- source="http://www.google.co.uk"
- width="100%"
- height="100%"
- />
- <local:IFrame id="test2"
- label="Yahoo"
- source="http://www.yahoo.co.uk"
- width="100%"
- height="100%"
- />
- </mx:TabNavigator>
- </s:Application>
- </SPAN>
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:local="*"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="init()">
<mx:TabNavigator id="tab"
width="100%"
height="100%">
<local:IFrame id="test1"
label="Google"
source="http://www.google.co.uk"
width="100%"
height="100%"
/>
<local:IFrame id="test2"
label="Yahoo"
source="http://www.yahoo.co.uk"
width="100%"
height="100%"
/>
</mx:TabNavigator>
</s:Application>
source就是需要引用的网页url了 ,看似简单的页面,其实AS文件内容可不老少