Flex实现的div浮动层效果的方法

来源:互联网 发布:淘宝网页打不开 编辑:程序博客网 时间:2024/05/19 19:33
实现FLEX的"DIV浮动层效果"
需求是鼠标移动到相应的DATAGRID的条目时出现该产品的图片,并且图片跟着鼠标的移动而移动
var titleWindow:TitleWindow;
var img:Image;
protected function dataGrid_itemRollOverHandler(event:ListEvent):void
{
// var posmodelVO:PosModelVO=dataProvider.getItemAt(event.rowIndex) as PosModelVO;
var posmodelVO:PosModelVO=event.itemRenderer.data as PosModelVO
if(titleWindow==null){
titleWindow=new TitleWindow();
img=new Image
img.width=100;
img.height=133;
img.maintainAspectRatio=false;
titleWindow.addElement(img);
titleWindow.width=110;
titleWindow.height=145;
titleWindow.setStyle("headerHeight","0");
titleWindow.setStyle('borderSides','solid');
titleWindow.setStyle('borderThickness','3');
PopUpManager.addPopUp(titleWindow,this,false);
}
if(posmodelVO.image!=null){
titleWindow.visible=true;
img.source=posmodelVO.image;
titleWindow.x=mouseX;
titleWindow.y=mouseY;
}else {
titleWindow.visible=false;
}
}
0 0