加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex4 datagrid里点击链接打开图片的方法

发布时间:2020-12-15 01:29:49 所属栏目:百科 来源:网络整理
导读:1. 在datagrid里面 加入链接 链接新窗口显示相关的图片 。 如下 mx:DataGridColumn? resizable="false" editable="false" headerText="查看大图" ??? ??????mx:itemRenderer??? ???????fx:Component??? ????????mx:HBox width="100%" horizontalGap="0"??? ?

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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读