These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Create an Interactive Map

mstrong180
Registered: Aug 17 2008
Posts: 6

I have a project I'm trying to finish. I can easily add Web links to lines of text for this interactive street map for a neighborhood group. However, some businesses do not have Web sites, and only have phone numbers.

I'd like to create an action whereby the user will click on the business name and a pop-up box shows up with the phone number, then goes away when they click away.

Any assistance is greatly appreciated.

Mike

My Product Information:
Acrobat Pro 8.0, Macintosh
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
There are a number of things you can do. The simplest is to use a form button and set the Tooltip text to display the phone number.

You can also use an alert box:

app.alert("Phone number is: 111-222-3333", 3, 0);

A custom dialog is similar but allows many more options, including images. For more information see the Acrobat JavaScript reference and http://www.windjack.com/products/acrodialogs.php

You can also use a JavaScript action to show a previously hidden button that displays the data you want to show:

getField("phone_no_1_button").display = display.visible;

The user could then click (MouseUp event) the button to make it hidden again:

event.target.display = display.hidden;

The advantage to using a button is a button icon can be anything a PDF page can be (text, images, graphics) and you have control over the size and position of the button.

George
mstrong180
Registered: Aug 17 2008
Posts: 6
Thanks

The alert box worked really well, but the others would not work.

Of course, the AcroDialog custom dialog box plugin would be ideal, but I'm not even making the cost of the plugin on this project, and I'm also on a Mac.

The "getfield" did not work either. I sent a version of the alert box to the client and I'll see what he says, but I'd like to somehow try those others as well to see if I like them better. Any further instructions on how to make those happen?

Thanks

Mike
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Mike,

The code I posted assumes you have a button named "phone_no_1_button" that is normally set to hidden. That button would be set up to display the phone number (Button Properties > Options > Label, or Button Properties > Options > Icon). When you click on the link or button for the business name, this button field then becomes visible due to the code in the link.Note that case in JavaScript is significant:

// This is correct
getField("phone_no_1_button").display = display.visible;

// This is NOT correct, due to small-case "f" in getField
getfield("phone_no_1_button").display = display.visible;

The other line of code is supposed to be placed in the Mouse Up event of the normally hidden button, so that when the user clicks it, it goes back to being hidden. Same idea as dismissing an alert box by clicking the [OK] button.

If you can't get it to work, please include more information on exactly how you've set things up.

George