Flash* is a vector graphic image type widely used in Web sites. Flash images are small, load quickly and support interactive capabilities such as drilldown, rollover and hover text. Flash images also support animations and auto-updating. Flash images print at a high resolution. Another advantage is that a user can put a Flash image directly into a Microsoft* PowerPoint* presentation.
The Flash Player (Flash 3.0 or later) is required to view a Flash image. It is estimated that more than 96% of Internet users already have the Flash Player.
More information about the Flash format is available from the Adobe* Web site at http://www.adobe.com/products/flash/flashpro/.
Note: Best Image Fallback lets a user’s Web browser dynamically decide what image format to display. In this case, it probably does not matter if you choose Flash or SVG* as the format of the Corda® image. The user sees the Corda image in JPEG format if he or she doesn’t have the Flash or SVG plug-in. For more information, see Best Image Fallback in the Corda 7 Developer Reference.
This section contains the following information:
Generate a Flash Corda image by setting the Corda Embedder outputType attribute to "FLASH." For example, assuming the Corda Embedder object is named myImage, you use the following command to set the image format to Flash:
myImage.outputType = "FLASH";
Generate a Flash Corda image using the @_FLASH server command. For example, the following HTTP request generates a Flash Corda image:
http://<server_address>:2001/?@_FILEexamples/bar.itxml@_FLASH
Flash images can be embedded into Web pages using an <object> tag for Microsoft Internet Explorer browsers and an <embed> tag for Firefox* browsers. Use the @_FLASH server command to instruct Corda Server™ to generate a Flash image.
The code below demonstrates how to embed a Flash image. Note that by embedding the <embed> tag within the <object> tag, the code makes sure that the image displays correctly on both Microsoft Internet Explorer and Firefox Web browsers.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="600" height="400">
<param name="MOVIE" value="http://<server_address>:2001/?@_FILEexamples/bar.itxml@_HEIGHT400@_WIDTH600@_FLASH">
<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="600" height="400" src="http://<server_address>:2001/?@_FILEexamples/bar.itxml@_HEIGHT400@_WIDTH600@_FLASH">
</embed></object>
Implement Best Image Fallback (i.e., an alternate image if the browser is incapable of downloading the Flash plug-in) to a JPEG or PNG image by embedding an <img> tag within the <embed> tag. For more information on embedding an image in the <img> tag, see Embedding a Corda image in an Image Tag in the Corda 7 Developer Reference.
Note: It is much more convenient to embed a FLASH image with the Corda Embedder.
Corda Server supports auto-updating Flash images. This feature lets you do two different things: display a single Corda image that refreshes itself automatically, or display a series of Corda images in a repeating loop. By using this feature, you can automatically display related and up-to-date images without the need for any client-side scripting.
Warning: The automatically-updated images feature is not compatible with animation.
URL List: Specifies one or more URLs, or file names, that the Image Template file displays. Specifying a single URL results in continually-updated Flash images or content. Specifying multiple URLs creates a repeating loop of different Flash images or content.
Playback Time: Specifies a amount of time, in seconds, that the Image Template file displays each URL in the URL List before re-loading an updated URL or loading the next URL in the URL List.
Playback Speed: When a URL consists of multiple frames, like a Flash movie, Playback speed specifies the number of frames to display per second. A typical setting for smooth playback is 20 (frames per second.)
More information on these properties is available in the Corda 7 Object Reference.
When a browser loads the initial Flash image (the one based on the Image Template file in which you specified the auto-updating settings), the image instructs the Flash plug-in to cycle through the URLs named in the Image Template file. These URLs can point to any Flash image you want to point to—even Flash images not generated by Corda Server.
The Flash plug-in cycles through these images continuously, using the auto-update interval specified in the Image Template file. This means, for example, if you only specify one Flash image URL, the plug-in continuously refreshes the image from the URL at the specified interval.
Note: Don’t specify auto-update settings in any of the Flash images you are loading. These only need to be set in the initial project file that is being loaded into the Web page.
Consider the following example: in an Image Template file that you are using to generate a Corda image in a Web page, you specify the following URLs in the auto-update list: http://myserver.com/getgraph?index=1, http://myserver.com/getgraph?index=2 and http://myserver.com/getgraph?index=3. Suppose the time interval for updating is 20 seconds.
When you first load the graph- or map-enabled Web page, the browser loads the base Corda image (from the Image Template file) into the Flash plug-in. After 20 seconds, it loads a Flash image from http://myserver.com/getgraph?index=1. After another 20 seconds, it loads a Flash image from http://myserver.com/getgraph?index=2. After another 20 seconds, it loads a Flash image from http://myserver.com/getgraph?index=3. The plug-in then continues to cycle through these three URLs until the browser leaves the page.
Important: All of the URLs in the auto-update list must return Flash (.swf) files. Otherwise, the plug-in is not able to display the URL.
Note that if a Flash image stored at one of these URLs changes, you see the changes in the auto-updating Flash image. So, for instance, if the data used to create the graph in http://myserver.com/getgraph?index=2 changes, the graph shown in the auto-updating Flash image changes accordingly, giving the graph the appearance of streaming its data.
Important: On some browsers, you may experience caching problems with auto-updating Flash images. To get around these problems, set the Content Expiration header for each Flash image you load to expire immediately. See Solving Caching Issues with Auto-Updating Flash Images (below) for details.
If you dynamically update Flash images, but do not see the changes reflected in the auto-updating Flash image, you might be experiencing Web browser caching problems.
When a Web server sends a file (whether it be an image or a Web page) to a browser, it includes some instructions—in other words a header—that help the browser know how to deal with that file. One piece of information it sends is the content-expiration header—that is, how long the browser should wait before checking the server to see if the file has been updated. If you request an image or Web page again but the content is not expired, the browser simply shows you the file that it received the last time it requested the image. Otherwise, it contacts the server to see if there is an updated file to download.
Some browsers make assumptions about content-expiration that can cause the browser not to check for updated content in auto-update Flash images. There are a couple of ways to fix this problem:
An easy (though understandably less desirable) solution to this problem is to change the browser’s settings so that it always checks for newer versions of Web pages and images.
To do this on Internet Explorer, for example, do the following:
Select 7 > Internet Explorer.
Under Temporary Internet Files, click the Settings button.
Under the Check for Newer Versions of Stored Pages option, select Every Visit to the Page.
The main drawback of this solution is that it requires you to instruct everyone who views the image to complete the same procedure.
To avoid having to rely on the clients to change their browser settings, modify the content-expiration header for each Flash image you load so that it expires immediately. By setting Flash images to expire immediately, you force the browser to always check for updated images.
Images Stored on A Web Server When loading Flash images that are saved to a Web server, set the content-expiration for the image on a file-by-file basis. The exact procedure for setting the content-expiration depends on the Web server. Some servers might not provide a mechanism for setting content expiration. For example, Windows* IIS uses the following procedure:
Open the Internet Information Services management console.
Using the tree on the left, browse to the Flash image file whose content expiration settings you want to change.
Right-click the Flash image file and select Properties.
Select the HTTP Headers tab.
Check the Enable Content Expiration box.
Under Content Should, select Expire Immediately.
Images served from Corda Server When retrieving Flash images from Corda Server using server commands, use the @_DONTCACHE command to force the content to expire immediately, as illustrated below:
http://<server_address>:2001/?@_FILEexamples/bar.itxml@_DONTCACHE
When loading a previously saved image, use the following command:
http://<server_address>:2001/?@_LOADimages/test.swf@_Flash@_DONTCACHE
Images Returned via a Web Application When using a Web application to output a Flash image directly to the browser (for example, using the Corda Embedder getBytes command), programmatically set the content-expiration header.
The following line of code shows how to do this in Java*:
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", 0);
The following line of code shows how to do this in ASP.NET:
Response.Cache.SetExpires(DateTime.Now);
See the Web application documentation for more information on how to do this in the Web environment.