六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 23|回复: 0

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

[复制链接]

升级  68.33%

119

主题

119

主题

119

主题

举人

Rank: 3Rank: 3

积分
405
 楼主| 发表于 2013-1-29 10:29:08 | 显示全部楼层 |阅读模式
问题: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();}}
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表