Here's a quick Example I made up: ------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" borderColor="#FFFFFF" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #FFFFFF]" width="304" height="154"> <mx:Script> <![CDATA[ public function urlGo():void { var url:String = new String(); if(urlInput.text == "" || urlInput.text == "http://") { url = "http://www.adobe.com"; } else { url = urlInput.text; } var myURL:URLRequest = new URLRequest(url); navigateToURL(myURL,"_blank"); } ]]> </mx:Script> <mx:Label x="84" y="70" text="Click This Link To Go!" textDecoration="underline" color="#1948E1" fontSize="12" buttonMode="true" useHandCursor="true" mouseChildren="false" click="urlGo();"/> <mx:TextInput x="10" y="40" width="284" id="urlInput" text="http://"/> <mx:Label x="10" y="22" text="Enter URL:"/> </mx:Application> ----------------------------------------------------------------------------------------------- A couple of things to note that I did here. 1) The link goes to a default URL (http://www.adobe.com) if no url is entered in the box, otherwise, it goes to the url in the box. 2) In order to make a hand cursor come over a label (and text) you need to set all three properties: buttonMode="true" useHandCursor="true" mouseChildren="false" Hope that helps some! Luke On Mon, Apr 13, 2009 at 1:33 PM, <[email protected]> wrote: > I still can't get the label to be clickable but I was able to add a > "hyperlink". > > Private function handleQryResult(evt:ResultEvent):void > { > > ... > > (newItem as Label).text = 'business'; > Formitem.addChild(newItem); > formitem.mouseChildren=false; > formitem.buttonMode=true; > formitem.useHandCursor=true; > formitem.setStyle('color','#0033ff'); > formitem.data = 'www.google.com'; > formitem.addEventListener(MouseEvent.CLICK,openWindow); > > ... > > } > > Private function openWindow(evt:Event):void > { > var myURL:String = evt.currentTarget.selectedItem.DATA.toString(); > var url:URLRequest = new URLRequest(myURL); > navigateToURL(url, "_blank"); > } > > > Tommy Geist > United Parcel Service > Program Management Group (PMG) > Atlas : 5 - 490 - 6418 > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf Of Laurence > MacNeill > Sent: Sunday, April 12, 2009 9:01 PM > To: [email protected] > Subject: Re: [AFFUG Discuss] "clickable" label on a form... > > At 08:23 PM 4/12/2009, you wrote: > >It would look more like this: > > > ><mx:LinkButton id="myLink" label="My Url" click="myLinkUrl();" /> > > > > > >And the AS: > > > >private function myLink():void > >{ > > var myUrl:URLRequest = new URLRequest("http://www.myUrl.com"); > > > >navigateToURL(myUrl, "_blank"); > > > >} > > > > > >That should do it if you are just wanting a URL button. > > So I can't change the destination programmatically, then? It has to be > hard-coded? > > > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe in > the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by http://www.fusionlink.com > ------------------------------------------------------------- > > > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe in > the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by http://www.fusionlink.com > ------------------------------------------------------------- > > >
