Preload Property

Description

This property can be used when preloading EditLive! for XML. Once EditLive! for XML has finished loading the JavaScript function defined by the Preload property is used as a callback.

Syntax

JavaScript

setPreload(strCallBack);

Parameters

strCallBack

A string specifying the name of a JavaScript function to use as the callback function once EditLive! for XML has finished loading.

Example

Example 16.27. Preload JavaScript Callback Function

The following code provides the JavaScript callback function which will display an alert dialog once EditLive! for XML has finished loading. The callback function is named preloadReturn.

<script language="javascript">
  function preloadReturn(){
    alert("EditLive! has finished preloading.");
  }
</script>

Example 16.28. Preload Property Example Scripting

The following example instantiate a version of EditLive! for XML and assign a function to be used as a callback once it has finished loading. The callback used in the example code is preloadReturn which is described by the code above. The example below instantiates an applet which is not visible, thus, it may be used in cases where the applet is to be preloaded, to decrease load times for future instances, but not visible.

JavaScript

var editlivejs;
editlivejs = new EditLiveXML("ELApplet1","1","1");
editlivejs.setConfigurationFile("sample_elconfig.xml");
editlivejs.setDocument(escape("<p>&nbsp;</p>");
editlivejs.setPreload("preloadReturn");

Remarks

The Preload property can be used to assist with the preloading of EditLive! for XML. This can improve the performance of EditLive! for XML within a Web application. Preloading EditLive! for XML causes the browser's XML Plug-In and the EditLive! for XML classes to be loaded.

It is recommended that, when preloading EditLive! for XML, you set the height and width of the EditLive! for XML applet so they are both one pixel. This will ensure that the EditLive! for XML applet is not visible on the page.

Preloading EditLive! for XML can be performed on any page within a Web application.