Select to view content in your preferred language

HTML Link from a shape file in "Label" inside "Component

1273
6
07-16-2010 04:39 AM
varnavarna
Emerging Contributor
Hello,

We are doing a layer in which you have some activities around town loaded in a shape file in SDE database. This layer is in a Flex application and when you put your mouse over and click an infoWindowRenderer pops up to dislpay an activity. The last field in this shape file is a HTML link to a picture on the server of the client and we need to make that link clickable or dislay the picture in the pop-up window. I tried to chande text to htmlText but that didn't work. I only managed to make the field available for copying the text with selectable="true". Can somebody share a way to make that link possible for clicking?

I'm attacing the code in a txt file

Thank you very much!

BR,
Deyan Kiryazov
Tags (2)
0 Kudos
6 Replies
BjornSvensson
Esri Regular Contributor
myText.htmlText = "How about <u>http://links.esri.com/flex</u>?";

See example in http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=SpatialRelationships using htmlText on mx:Text.
0 Kudos
varnavarna
Emerging Contributor
Bjorn, thank you for your reply. But the solution you provided is for a html link entered in the code of the Flex application. In our case the URLs are in a field in a layer on the Dynamic Map Service that the application is using. This way our client can add entries to the layer in the hosted .mxd and they will show up on the map in the Flex app. I need a way to make a certain field of the info pop-up window to be seen as an html link.

I think this thread has something similar --> http://forums.esri.com/Thread.asp?c=158&f=2421&t=292186&mc=3 , but the Query here populates a DataGrid and I am struggling to get it working with infoWindowRenderer.

Thank you very much for your help!

BR,
Deyan Kiryazov
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Deyan,

   Try this:
<mx:Component className="MyInfoWindowRenderer">
    <mx:VBox label="�?úáèòèÿ" backgroundColor="0xEEEEEE">
        <mx:Label text="State Fips: {data.Descriptio}"/>
        <mx:Label text="Abbreviation: {data.Where_}"/>
        <mx:Label text="Abbreviation: {data.Info}"/>
        <mx:Label click="navigateToURL(new URLRequest('{data.Photos}'), '_blank');" htmlText="Abbreviation: <u>{data.Photos}</u>"/>
    </mx:VBox>
</mx:Component>
0 Kudos
varnavarna
Emerging Contributor
Robert, I changed the code as you suggested.

<mx:Label click="navigateToURL(new URLRequest('{data.Photos}'), '_blank');" htmlText="Abbreviation: {data.Photos}"/>  (only removed the <u> tag because I was getting an error)

With the last line changed like that, the link is now clickable but it leads to ...Flex project folder.../bin-debug/%7Bdata.Photos%7D. When I cnahge  " URLRequest('{data.Photos}') " to a HTML link to the pictures directory or one of the pictures it opens the address. I guess the problem is that when it's done this way it is not reading from the field in the layer of the service.

htmlText="Abbreviation: {data.Photos}" is leading to the right address because it's getting its data from the layer in the REST service but the other {data.Photos} is recognized just as a text for a link I guess.

Sorry for my English but I'm trying to explain it with as much detail as I can.

Thanks for the replies!

Deyan Kiryazov
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Deyan,

   OK I see my mistake try this:
<mx:Label click="navigateToURL(new URLRequest(data.Photos), '_blank');" htmlText="Abbreviation: {data.Photos}"/>
0 Kudos
varnavarna
Emerging Contributor
Robert, with this correction it worked like a charm!

Thank you very much for your help! You saved me a lot of time and nerves.

BR,
Deyan Kiryazov
0 Kudos