Tutorial 3: Resize Window Action - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
actions so they are well behaved in all browsers. If the script will not work, it should be ignored by
the browser and not produce any errors.
Since this script won't require any user input, it won't need a csactionparam tag. Delete this tag
from the page. If you look at the source you will see that you now have only opening and closing
csactionclass tags, the minimum required for an action file. The attributes of the opening tag
are the values you set in the Inspector. At this point your csactionclass object is complete.
7. Now it's time to create your JavaScript code. Double-click on the JavaScript icon to bring up the script
editor. Note that the editor opens the file OpenAlertWindow.scpt . Be careful not to make any
changes in this file. Save a copy of this file in your new test folder under a meaningful name that can
be easily associated with your action file (for example. PreviousURL.scpt ).
8. In the Layout view, click on the JavaScript icon to bring up the Inspector. Set the Language to the level
of browser you expect to support. In this case, use Navigator 3.x. The JavaScript language version
number will change automatically to match. This is a guide to which language reference you can use
for compatibility.
9. Since the JavaScript source will be the file you created in step
checked. The file name in the text field is the relative path to the source file. Click the folder icon and
select the script file you created (look at the pop-up menu for other ways of specifying the file name).
10. Now double-click the JavaScript icon to open the script editor again. Replace the existing code with the
following:
function CSGoBack1() { history.back() }
With all GoLive actions, you embed your JavaScript code between the two curly brackets of the initial
function. In this case the initial function is: CSGoBack1() {}
This code is an example of a very simple script which uses no arguments, thus it requires no parameter
values. For more on how parameters work see
11. The last step in creating this action is to modify the layout grid for the Inspector dialog box content.
Since there are no input fields, you can delete the "msg" parameter field and change the "Message"
label field to include a message for the user in the Name field, something like "Use this action to return
to the previous URL. " Resize the text object and the Layout Grid as needed.
12. Save your completed action. Close and restart GoLive so your new action will appear in the actions
menu. If, on restarting the application, GoLive crashes or you get an error message, it means there's an
error in your action file. Just remove the action file from the folder and restart. GoLive also generates a
log file listing the offending action that can give you more information on the nature of the error. The
log file is located in the same folder as the GoLive application.

Tutorial 3: Resize window action

In this example you will create a slightly more complicated action, one that takes input values from the
GoLive user and passes this info to the JavaScript code for handling.
Procedure
1. Copy an existing action such as Open Window Alert.action and this time name it Resize
Window.action .
2. Open the action file in GoLive and change the action title to "Resize Window Action".
Adobe GoLive CS2 SDK
Tutorial 3: Resize window
Extending GoLive Actions
, make sure the Source checkbox is
7
action.
167

Advertisement

Table of Contents
loading

Table of Contents