1. 在datagrid里面 加入链接
链接新窗口显示相关的图片
。
如下
<mx:DataGridColumn? resizable="false" editable="false" headerText="查看大图" >???
??????<mx:itemRenderer>???
???????<fx:Component>???
????????<mx:HBox width="100%" horizontalGap="0">???
?????????<mx:LinkButton label="查看大图" click="parentDocument.viewBigImage()" />???
?????????
????????</mx:HBox>???
???????</fx:Component>???
??????</mx:itemRenderer>???
?????</mx:DataGridColumn>
?
?
方法:
???/**
??? * 原作查看大图 yanek 增加该方法
??? */
???public function viewBigImage():void{
????//选中的行数
????var k:int = this.originalPicList.selectedIndex;
????//Alert.show("k="+k);
????//获取dataGrid中的数据
????var arr : Array =(originalPicList.dataProvider as ArrayCollection).source;
????//获取当前选中行的dictType列的数据
????var path:String = arr[k]["picUrlImage"].toString();
????
????var path1:String = this.originalPicList.selectedItem.picUrlImage;
????
????
????//Alert.show("path="+path);
????
????
????var window : ViewBigImage = PopUpManager.createPopUp(this,ViewBigImage,true) as ViewBigImage;
????window.owner = this;
????//window.bigimage.source = path;
????window.bigimage.source = path1;
????PopUpManager.centerPopUp(window);//弹出子窗口
????
???}
???//////////////////////
?
注意:取得路径的方法 var path1:String = this.originalPicList.selectedItem.picUrlImage;
?
?
?
弹出新窗口代码:ViewBigImage.mxml
?
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" ????? xmlns:s="library://ns.adobe.com/flex/spark" ????? xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" close="PopUpManager.removePopUp(this)" title="大图查看" width="681" height="498">?<s:layout>??<s:BasicLayout/>?</s:layout>??<fx:Script>??<![CDATA[??????import mx.collections.ArrayCollection;???import mx.controls.Alert;???import mx.core.Application;???import mx.managers.PopUpManager;???import mx.rpc.events.ResultEvent;?????????private var trme : String = Math.random().toString();???private var dtArray : ArrayCollection = new ArrayCollection();????????????protected function init():void{???????}??????protected function close_window():void{????PopUpManager.removePopUp(this);???}?????]]>?</fx:Script>?<fx:Declarations>??<!-- 将非可视元素(例如服务、值对象)放在此处 -->?</fx:Declarations>?<mx:Image x="58" y="20" width="564" height="391" id="bigimage"/></s:TitleWindow>