The Creative Toolbox: Exploiting GoLive Actions

Imagine receiving a complete toolset as a gift one day. Socket wrenches, wire cutters, drill bits, along with tools you don’t even know the names of, much less how to use. Of course many tools in the set are valuable, but because you’re not quite sure what they’re for, you find yourself never really using the not-so-familiar tools. If you find yourself feeling this way about the more complex, less common set of actions found within GoLive, get ready for a boost: Actions such as Group Actions, KeyCompare, and Idle may well help speed you along through your work.

Walking and Chewing Gum
The Action Group action is one of the more straightforward and useful actions in the Specials submenu. This choice allows you to string a series of actions together sequentially, triggered by one event, such as when the viewer clicks a link, presses a key, rolls over a button, etc. The actions might also be triggered from an event such as a page load, when the page is being parsed or exited. They can even be inserted into animations to run at certain points in the TimeLine. GoLive will perform the actions in the order you specify them.

Once you’ve defined an action group, using it becomes a simple, one-step process. An additional benefit of defining action groups is that if you need to change a URL, for instance, you’ll only have to do it once instead of multiple times in the page body.

As our example, we’ll create an Action Group that sets a button image to a down state and loads in a certain URL. This Action Group will be triggered whenever the viewer clicks the button.

If you want to follow along, visit this link, and copy the three pages of HTML source files down to your hard drive and open them in GoLive 5. These files have an Action Group specified, but no actions called. To take a look at the completed project, click here.

First, we need to set up an Action Group to run as a page-loading event. Create a Head Action by doing the following:

  1. Drag the Head Action icon from the Smart tab of the Objects palette to the head section of your document. You can also just double-click the Head Action icon if the head section is already open.
    Select the Head Action icon from the Smart tab of the Objects palette.

  2. With the Head Action still selected, go to the Inspector and choose an action trigger from the Exec. pop-up menu. For this example, choose OnCall, which will initiate the action when it is referenced by a Call action inside the page.
    Select OnCall, which will initiate your action when it is referenced by an event inside the page.

    In the future, if you would like your action to take place after the page is done loading in the browser, go with the default, OnLoad selection. If you prefer it to occur while the page is being loaded, choose OnParse. OnUnload triggers actions when the page is exited.

  3. From the Action menu in the Inspector, select Action > Specials > Action Group. Now you are ready to add as many actions as your heart desires. Click the Add icon to add new actions to your list.

    Select Action Group and begin creating actions.

A Call to Action
Now that we’ve set up our group of actions, we need to key the actions to run in response to a specific viewer-triggered event within the page — the clicking of the button. This is where the Call Action comes in. Don’t be put off by its rather complicated name. The steps involved in setting up Call Action are surprisingly simple.

To define our Action Group as a Call Action, do the following:

  1. Go to the Inspector and choose OnCall from the Exec. pop-up menu.
  • Give the OnCall action a unique name in the Name field beside the Exec. pop-up menu. Let’s call our actions “next” and “prev.”
    Name your action. For this example, we called ours “next” and “prev” appropriately.

  • Now go into the page and create a simple link. Go to the Actions palette and choose Mouse Click as the trigger event. Then click the Add button.
  • From the Action menu, select Action > Specials > Call Action.
  • A red “C” icon along with a blank pop-up menu should appear. If everything is correct, the name of your OnCall action (next) should emerge as the choice when you click on the pop-up menu. Go ahead and choose your OnCall action.
    The name of your Action group should appear in the popup

  • Now preview all your hard work in a browser by selecting Special > Show in Default Browser.What To Do?
    Now that you’ve saved yourself so much coding time, maybe you’re ready to try your hand at another batch of actions. Let’s give your Web visitors the ability to move within your site using only their keyboards. This exercise teaches you some new buzzwords — “Idle/KeyCompare” — and takes advantage of the steps we just completed above. It may sound complicated, but bear with me: Once we’ve gone through it once it’ll make a lot of sense.

    The KeyCompare action works with the Idle action. You use KeyCompare to specify a specific condition that has a true or false value, such as “Has the ‘>’ key been pressed?” The Idle action sits in the head section, constantly checking for any assigned events. In our example, it’s looking at the value of the KeyCompare condition, to see if the action you specified is happening or not. If the value is False, then the Idle action keeps checking; if it’s True, then the Idle action calls whatever action you specify. Sounds like techie stuff, I know, but fortunately GoLive’s intuitive interface makes incorporating this function as painless as possible.

    We’ll set up a KeyCompare/Idle action pair that enables the viewer to navigate through our site using their “<” and “>” keys (as in a slideshow presentation). Then we’ll specify the Action Group we defined above as the action to be triggered to offer a little feedback (changing the button state) and load the correct pages when each button is pressed.

    Follow these steps:

    1. Drag the Head Action from the Smart tab from the Objects palette into the head section of your page.
    2. In the Inspector, choose Action > Specials > Idle.
      Select the Idle Action.

    3. Click on the Condition tab and choose Action > Specials > KeyCompare in the second Action menu.
      Select KeyCompare start hunting for ACII codes for your chosen keys (hint: “>” is 46 and “<” is 44).

    4. Enter in the ASCII character code of the appropriate keystroke into the CharCode field. To figure out the ASCII code of a keystroke, try a shareware utility such as CodePerfect 2.2 (Mac only).
    5. Click on the True tab and choose the action or Action Group that you would like the keystroke to trigger — in this case, the ActionGroup action we created earlier. Be sure not to enter any actions in the False tab.
      Selecting your Action group will trigger the actions it contains whenever the specified event (in this case, a key being pressed) occurs.

    Now preview your work in the browser and test the interaction. It’s a good idea to add some sort of hint to the viewer to make them aware that certain keys do certain actions, otherwise all your work will end up an Easter egg.

    To view the finished pages I made, click here.

    Using actions may seem complicated at first, but GoLive makes it easy to utilize these features previously relegated to the realm of the hard-core coder. Experimenting with these features for even just a few hours reveals their potential to take a good bit of drudgery out of both building and maintaining your sites.

     

Bookmark
Please login to bookmark Close

This article was last modified on January 8, 2023

Comments (3)

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. GoLive actions. Such a great invention. If there’s an update, just rebuild your javascript library. Done!

  2. This is an awful lot of steps for something that appears to create a rollover button and a set of commands that don’t work. There’s something very wrong with this example.

  3. Doesn’t seem to work in Netscape