<< back to knowledgebase home

Flattening the Script Library and MenuMachine (MM1, MM2)

Article Applies To:

MenuMachine 1 & 2

GoLive 6, CS, CS2

Mac, Windows

Article ID: 000022

Category: General Issues

Issue

What does "Flatten the Script Library" mean?

Does flattening the GoLive script library affect MenuMachine?

Solution

When do I need to flatten the Script Library?

You should use the Flatten Script Library command if you have used GoLive Actions or used GoLive Rollovers in your site.

Flattening the Script Libray does not affect MenuMachine but if you are having problems on a page which uses Actions or Rollovers, make sure the Script Library is flattened. Problems with Actions can prevent other JavaScript on the page (including menus) from working.


What is the Script Library?

When you place a GoLive Action or Rollover on a page in your site, a JavaScript library file is automatically created and placed in your site. This "Script Library" file contains the JavaScript code required for Actions and Rollovers to work once your pages containing Actions or Rollovers are uploaded to a server. The JavaScript code in the Script Library file tells browsers what to do when an Action or Rollover is triggered.

This Script Library is a separate file that each page with an Action or Rollover will link to. Using this external file means that it only needs to be loaded once in the browser to be used by all pages in your site.

The JavaScript can alternatively be written into your pages but that will add a lot of code (therefore download time) to each page. Linking to the external file is more efficient.


What is the Script Library file called?

The file is called CSScriptLib.js and is placed in the GeneratedItems folder automatically by GoLive if you are using the default settings. The GeneratedItems folder must be uploaded to the server for Actions and Rollovers to work when the site is published. Do not rename or move the GeneratedItems folder or its contents.


What does "flattening" the Script Library do?

The CSScriptLib.js file contains the code for all the GoLive JavaScript Actions even if you have only used one or two different Actions in your site.

Flattening the file removes any JavaScript code from the Script Library file contained in your site that is not needed for your site. This reduces the library's file size and decreases its download time. The reduction in size can be quite dramatic – e.g. reducing the file from around 100Kb down to about 10kb.

If you have used any Third-Party Actions, flattening will incorporate their JavaScript code into the CSScriptLib.js file also.


How does flattening affect MenuMachine?

Flattening the Script Library file has no direct effect on MenuMachine code or menu functionality.

However, if your page is having problems in the browser that are caused by a non-working Action or Rollover which loads before your menu, this can prevent your menu from working if the browser has "stalled".

It is a good idea to ensure your Script Library has been flattened and re-uploaded if you are experiencing any JavaScript problems in the browser.

MenuMachine 1 has its own JavaScript library file called menumachine.js which gets saved into the GeneratedItems folder the first time you save a menu page into your site; if the GeneratedItems folder has been deleted; or if MenuMachine detects a newer version of the menumachine.js file in your GoLive folder (i.e. an upgrade). It is not affected by flattening the main GoLive script library.

However, sometimes errors in JavaScript can cause some browsers (e.g. Internet Explorer) to stop loading other scripts into the page. This may cause the menus on the page to not load. Flattening the Script Library can fix some JavaScript errors, thereby allowing the menu to load correctly.

MenuMachine 2 does not place any code in the GeneratedItems folder at all, instead it uses a special folder named menumachine in the root of the site which contains support files. Flattening the script library will have no effect on MenuMachine 2.


How do I flatten the Script Library?

You can manually flatten the library file of a single site, set a site's Site Upload or Export preferences to automatically flatten the library file, or set the application preferences to flatten the library file of all sites before upload or during export.

1) To manually flatten the JavaScript library of a single site:
Open a site window and choose Site > Flatten Script Library.

NOTE: If you manually flatten the script library, you must remember to do this again if you later edit any pages which contain a GoLive Action as GoLive may un-flatten the file.

2) To set a site's preferences to flatten the JavaScript library upon upload or export:
1. In the Site Settings dialog box, select Upload/Export.
2. Select Site specific settings.
3. Select Flatten Script Library and click OK

3) To set all sites to flatten the JavaScript library upon upload or export:
1. Choose Edit > Preferences.
2. Expand Site and select Upload / Export.
3. Select Flatten Script Library and click OK.


Special Instuctions for Third Party or Additional Actions

If you have downloaded additional Actions from Adobe or third-party developers, your CSScriptLib.js file may not automatically update to include the new JavaScript code.

You may need to follow these instructions if you notice that your new Actions do not work once uploaded.

To force GoLive to add the needed JavaScript for the additional Actions installed, you can use the Rebuild button in GoLive > Preferences > Script Library to actually update the code of freshly installed or removed Actions in the Script Library. This updates the master script library in GoLive folder so only needs to be done whenever you change the Actions installed in GoLive.

To ensure your Script Library is up-to-date:

  1. Close GoLive
  2. Install Actions
  3. Start GoLive
  4. Go to Preferences > Script Library > Rebuild (make sure "Import GoLive Script Library" button is selected)
  5. Restart GoLive
  6. Open site
  7. Flatten Script Library
  8. Re-upload the CSScriptLib.js file

This procedure should eliminate all possible problems.

Last updated: November 6, 2006

This article has been viewed 6231 times.

Related articles