5/27/2010 4:52:54 AM
Title:
label as link with dynamic href
I am using the label as a link in my app. I want to pass the href dynamically can any one help me
<mx:Label textAlign="right" fontWeight="bold" textDecoration="underline" fontFamily="verdana" selectable="true" link="logOffClickHandler(event);">
<mx:htmlText>
<![CDATA[<a href='event:https://www.mydomain.com/home/home.jsp'>Log Off</a>]]>
</mx:htmlText>
</mx:Label>
thanks
dme
Tyson
Points: 680
Posts:0
5/27/2010 5:45:36 AM
you can change the link and text and link dynamically by setting the htmlText property of lable
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768">
<mx:Script>
<![CDATA[
protected function button1_clickHandler(event:MouseEvent):void
{
htmlLabel.htmlText="seswfsw sd <a href='event:https://www.mydomain.com/test.html'>Text and Link Changed</a>";
}
]]>
</mx:Script>
<mx:Label id="htmlLabel" textAlign="right" fontWeight="bold" textDecoration="underline" fontFamily="verdana" selectable="true" >
<mx:htmlText>
<![CDATA[<a href='event:https://www.mydomain.com/home/home.jsp'>Log Off</a>]]>
</mx:htmlText>
</mx:Label>
<mx:Button x="43" y="80" label="Change Label link" click="button1_clickHandler(event)"/>
</mx:Application>
11/9/2010 1:45:08 PM
I think the real question is how to mix a bindable property into the htmltext string. If you wanted to load the href attribute from a property provided through, say xml that was being passed from a repeater as a property of the current item. That's what we need to see.