Flex嵌入IFrame

1 篇文章 0 订阅
1 篇文章 0 订阅

为了在Flex页面中嵌入Html页面以显示报表,百度了一下,找到一个方法,可以在Flex页面中嵌入IFrame,这个IFrame可以有一个source,这个源就是一个Html页面。

详细步骤:

1、Flex项目中导入flex-iframe(-1.5.1).swc

2、新建一个Flex页面,此处有个现成的例子,百度来的

如下:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
				xmlns="*"
				xmlns:ns="http://code.google.com/p/flex-iframe/"
				creationComplete="iFrame.visible=true" viewSourceURL="srcview/index.html"> 
	<mx:HBox width="100%" height="100%">
		<mx:Panel width="200" height="100%" title="Tree">
			<mx:Tree id="tree" width="100%" height="100%"
					 change="iFrame.source = (Tree(event.target).selectedItem.attribute('path').toString());"
					 dataProvider="{treeData}" labelField="@label" showRoot="false"/>
		</mx:Panel>
		<mx:Panel width="100%" height="100%" paddingBottom="1" paddingLeft="1" paddingRight="1"
				  paddingTop="1" title="Content">
			<ns:IFrame id="iFrame" width="100%" height="100%"
					   source="http://www.adobe.com/devnet/flex/"/>
			<mx:ControlBar>
				<mx:CheckBox id="cbVisible" label="IFrame Visible"
							 click="iFrame.visible=cbVisible.selected" selected="true"/>
			</mx:ControlBar>
		</mx:Panel>
	</mx:HBox>
	
	<mx:XMLList id="treeData">
		<node label="Flex Resources">
			<node label="Flex Developer Center" path="http://www.adobe.com/devnet/flex/"/>
			<node label="Flex Team Blog" path="http://weblogs.macromedia.com/flexteam/"/>
			<node label="Flex Blogs on MXNA"
				  path="http://weblogs.macromedia.com/mxna/FeedList.cfm#Flex"/>
			<!-- these sites pop themselves out of a frame:
			<node label="flex.org" path="http://www.flex.org" />
			<node label="Adobe Labs" path="http://labs.adobe.com/wiki/index.php/Main_Page" />
			-->
		</node>
		<node label="Search">
			<node label="Google" path="http://www.google.com"/>
			<node label="Yahoo" path="http://www.yahoo.com"/>
		</node>
	</mx:XMLList>
</mx:Application>

重点内容是<ns:IFrame id="iFrame" width="100%" height="100%" source="http://www.adobe.com/devnet/flex/"/>

其中的source属性可以链接一个Html页面,将自己的Html页面地址放在这里就OK了。


PS:IFrame有个处于页面顶层的特点,当弹出对话框或控件的时候,重叠部分就会被IFrame盖住,建议在弹出对话框或控件的时候先把IFrame隐藏,关闭后再显示。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值