Flex4 中添加超链接的完整方法

<s:Datagrid>的添加超链接方法(链接文字会重叠)

<s:GridColumn dataField="_fileName" headerText="文档">

<s:itemRenderer>

<fx:Component>

<s:GridItemRenderer>

<mx:HBox horizontalScrollPolicy="off"

width="100%"

fontSize="12"

paddingTop="0"

paddingBottom="0"

horizontalAlign="left">

<fx:Script>

<![CDATA[

[Bindable]

private var _fileName:String;

override public function set data(value:Object):void

{

super.data=value;

if(data)

{

_fileName=data._fileName;

}

else

{

_fileName="";

}

}

]]>

</fx:Script>

</mx:HBox>

<mx:LinkButton label="{_fileName}" color="blue"  click="outerDocument.downLaws(event)"/>

</s:GridItemRenderer>

</fx:Component>

</s:itemRenderer>

</s:GridColumn>

<fx:Script>
<![CDATA[

private var As:downAs=new downAs();

/**
* 下载文件
* */
public function downLaws(event:MouseEvent):void
{
As.downLaws(this);
}

]]>
</fx:Script>

————————————————————————————————————————————————————————————————————————

<mx:Datagrid>的添加超链接方(链接文字不重叠)

<mx:DataGridColumn dataField="_fileName" headerText="文档" ><mx:itemRenderer>

<fx:Component>
<mx:HBox horizontalScrollPolicy="off">
<fx:Script>

<![CDATA[

[Bindable]

private var _fileName:String;

override public function set data(value:Object):void
{
super.data=value;
if(data)
{
   _fileName=data._fileName;
}
else
{
 _fileName="";
}

}

]]>

</fx:Script>
<mx:LinkButton label="{_fileName}" color="blue" click="outerDocument.downLaws(event)"/>
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

<fx:Script>
<![CDATA[

private var As:downAs=new downAs();

/**
* 下载文件
* */
public function downLaws(event:MouseEvent):void
{
As.downLaws(this);
}

]]>
</fx:Script>

上一篇:C# Excel添加超链接


下一篇:TextView 中添加超链接