flex嵌入html完整页面and嵌入其他项目swf文件
以下内容摘抄来自互联网
http://xintao222.iteye.com/blog/797566
将 html 页面 或 jsp 页面嵌入 到flex 页面中
step1:下载 flex-iframe-1.5.1.swc
http://code.google.com/p/flex-iframe/
step2:将此文件拷贝到flex项目的flex_libs文件夹下
step3:创建mxml文件 vboxiframe.mxml
<?xml version="1.0" encoding="utf-8"?><mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:code="http://code.google.com/p/flex-iframe/" width="100%" height="100%"><mx:HDividedBox x="0" y="10" width="100%" height="100%"> <mx:Panel width="30%" height="100%" layout="absolute"> <code:IFrame id="frm2" source="Demo/WebContent/topology.html" height="100%" width="100%"/> </mx:Panel> <mx:Panel width="70%" height="100%" layout="absolute"> <code:IFrame id="frm1" source="Demo/WebContent/topology.html" height="100%" width="100%"/> </mx:Panel></mx:HDividedBox></mx:VBox>
<mx:Script><![CDATA[import gs.plugins.VolumePlugin;import mx.events.FlexEvent;import mx.controls.SWFLoader;import mx.managers.SystemManager;private function init():void{ var loader:SWFLoader = new SWFLoader(); loader.percentHeight = 100; loader.percentWidth = 100; loader.addEventListener(Event.COMPLETE, onLoaded); loader.addEventListener(IOErrorEvent.IO_ERROR, onError); //loader.load("Demo/WebContent/topology.swf"); //smp31.swf //D:\develop\develop_WorkSpace\liferaySmp31\smp31\WebContent\Demo\WebContent\topology.swf // loader.load("D:\develop\develop_WorkSpace\liferaySmp31\smp31\WebContent\Demo\WebContent\topology.swf"); addChild(loader); } private function onError(e:Error):void{} private function onLoaded(e:Event):void{ var loader:SWFLoader = e.target as SWFLoader; var sysMgr:SystemManager = loader.content as SystemManager; sysMgr.addEventListener(FlexEvent.APPLICATION_COMPLETE, onAppComplete);}private function onAppComplete(e:FlexEvent):void{ var sysMgr:SystemManager = e.target as SystemManager; //如果此页面是application就转成application如果是 module 就转成 module // var app:Application = sysMgr.getChildAt(0) as Application; var app:Module = sysMgr.getChildAt(0) as Module; //app.callAPI(parameters);}]]></mx:Script>
<mx:VBox width="100%" height="100%"> <mx:SWFLoader source="http://localhost:8080/topology/topology.swf" width="100%" height="100%"/></mx:VBox>