`
wyzxzws
  • 浏览: 380913 次
  • 性别: Icon_minigender_1
  • 来自: dazhou
社区版块
存档分类
最新评论

Flex弹出框添加IFrame,jsp或者html页面不随弹出框一起移动问题

阅读更多

问题:Flex弹出框添加IFrame,jsp或者html页面不随弹出框一起移动问题

解决方案:为弹出框添加move事件监听,然后调用iframe的invalidateDisplayList()方法,ok了。

import com.google.code.flexiframe.IFrame;
	
	import flash.events.MouseEvent;
	import flash.external.ExternalInterface;
	
	import mx.controls.Alert;
	import mx.controls.TextInput;
	import mx.events.CloseEvent;
	import mx.events.DragEvent;
	import mx.events.MoveEvent;
	import mx.managers.PopUpManager;
	
	import org.osmf.containers.HTMLMediaContainer;
	
	import spark.components.Panel;
	import spark.components.TitleWindow;
	import spark.layouts.VerticalLayout;
	
	public class AlertWindowExample extends TitleWindow
	{
		public function AlertWindowExample()
		{
			super();
			setStyle("paddingLeft", 10);
			setStyle("color", "red");
			title = "xxxx";
			width = 300;
			height = 400;
			layout = new VerticalLayout();
			var ifr:IFrame = new IFrame();
			ifr.source = "NewFile.jsp";
			//ifr.source = "http://www.baidu.com";
			ifr.width = 200;
			ifr.height = 300;
			
			/*isPopUp = false;*/// 设置弹出框不能被拖拽
			addElement(ifr);
			
			var txt:TextInput = new TextInput();
			txt.text = "text";
			addElement(txt);
			
			addEventListener("move",ifrDragHandler,false);// 组件移动时事件
			addEventListener("close",close, false);
		}
		private function ifrDragHandler(evt:MoveEvent):void{
			Alert.show("===");
			var thisNode:AlertWindowExample = evt.currentTarget as AlertWindowExample;
			var ifr:IFrame = thisNode.getElementAt(0) as IFrame;
			ifr.invalidateDisplayList();// 避免弹出框移动时,jsp或html页面不一起移动
			evt.stopPropagation();// 阻止事件冒泡
		}
		
		private function close(evt:CloseEvent):void {
			PopUpManager.removePopUp(this);
			evt.stopPropagation();
		}
	}
 
分享到:
评论
1 楼 asigh 2013-12-10  
麻烦博主给下整个mxml文件的代码,1104858212@qq.com

相关推荐

Global site tag (gtag.js) - Google Analytics