To display a Flash movie, the browser requests the movie from a Web server. The server passes the movie to the browser as an HTTP transaction with an HTTP header containing an MIME type of application/x-shockwave-flash. You can simulate this behavior with Active Server Pages.

The following example constructs an HTTP header for a Flash movie and then uses the binary information generated from a Swiff Chart object to provide a Flash movie to the browser.

FILE: ShowSwiffChart.asp

 <%@ LANGUAGE="VBSCRIPT" %>

 <%
 Set chart= Server.CreateObject("SwiffChartObject.ChartObj")

 Dim myArray(4)
 myArray(0)= "North America"
 myArray(1)= "South America"
 myArray(2)= "Europe"
 myArray(3)= "Middle East"
 myArray(4)= "Asia"

 ' Fill the chart with the categories stored in the myArray variable
 chart.SetCategoriesFromArray myArray

 ' Add the first series "Sales"
 myArray(0)= 12
 myArray(1)= 7.5
 myArray(2)= 11.3
 myArray(3)= 9.2
 myArray(4)= 5.3

 ' Fill the first series with the data stored in the myArray variable
 chart.SetSeriesCaption 0, "Sales"
 chart.SetSeriesValuesFromArray 0, myArray

 ' The following load line assumes you have created a Swiff Chart style file named myStyle.scs
 chart.LoadStyle "C:\myStyle.scs"

 ' Finally generate the Flash chart and provide the browser with it
 chart.ExportAsResponse

 ' Release the chart object
 Set chart= Nothing

 Response.End
 %>

This script only generates a Flash movie. If you wish to display a Flash movie from an HTML or ASP document you must refer to this script in two tags: the OBJECT tag and the EMBED tag. See Inserting a Flash movie into a HTML page for more information on how to correctly display a Flash movie in a web page.

For example, if you wished to display this generated Flash movie with a caption describing it, you might use the following HTML page:

FILE: ShowSwiffChart.html

 <HTML>
 <HEAD><TITLE>Display Swiff Chart animation</TITLE></HEAD>
 <BODY>
 This page will display a Swiff Chart animation dynamically generated
 from an ASP page.<BR>

 <OBJECT ALIGN=CENTER 
            WIDTH=430 
            HEIGHT=150 
            CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
            CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0">
   <PARAM NAME=movie VALUE="ShowSwiffChart.asp">
   <PARAM NAME=quality VALUE=high>
   <EMBED src="ShowSwiffChart.asp" WIDTH=430 HEIGHT=150 QUALITY=high PLUGINSPAGE="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash">
   </EMBED>
 </OBJECT>

 </BODY>
 </HTML>

Note: Since the ASP script sets the Response.ContentType variable as "application/x-shockwave-flash", Internet browsers assume that raw SWF data (Flash format) follow the HTTP header. If any extraneous information follow the HTTP header the Flash movie will not display properly. This becomes important when you use the ExportAsResponse Method into an ASP script.

The browser needs to know what type of content is being presented. Do this by specifying the proper mime type in the Response.ContentType variable. For example, if you wanted to view a GIF image, you would set the ContentType = "image/gif".

See Also

Creating a Chart Using Data Specified in Arrays
Creating a Chart Using Data Specified in Strings
Creating a Chart Using Data From a Query
Creating a Chart Using Data From an ADO Recordset
Inserting a Flash movie into a HTML page
ExportAsResponse Method