| By Andrew Stopford | Article Rating: |
|
| October 18, 1999 12:00 AM EDT | Reads: |
6,743 |
Shockwave Flash is all over the Web. Its eye-catching, interactive animations have found a place on today's Web, and most Web firms use both Flash and its bigger brother on both their own and their clients' Web sites.
Just over a year and a half ago, Macromedia introduced a product called Generator, and Flash got even better. What Is Generator?
Generator allows Flash to dynamically change its own content, be it text or colors. It can even insert graphics, change the position of elements in the movie, and query databases for scrolling tickers and graphs. The key word to Generator is dynamic.
How Can I Use Generator?
Generator is split into two parts. Offline is a command-line-driven program (e.g., DOS) where for a given Generator file (or Shockwave Template - SWT) it will create an SWF (Shockwave Flash) file. Offline Generator can also create images, server-side and client-side image maps, and projector files (for running as an EXE file). Sample use would be:
Generate -swt myfile.swt myfile.swf
Online Generator is installed as a Java servlet to your Web server, running under JRun. This allows the Web server to process a request for an SWT. The servlet processes the SWT file, adding data and changing the contents of the file as indicated within it. What the servlet returns is a finished SWF ready to be run within the Web page. Online Generator can also create images as well as SWF files.
The process is quite transparent, and the user won't know that the Web server has just built the Shockwave animation they see in their browser.
Creating an SWT File
I won't go into in-depth use of the Macromedia Flash product here. As part of an online demo I will show how you can use it with Generator. Open up Flash and add a text item as shown in Figure 1.
Note the {} brackets. They indicate a Generator variable. Whatever data we now pass to the SWT file, if it points to that variable, then that variable will get that value. Make sure you save the file as an SWT file.
Using ColdFusion with Generator
I will demonstrate here how to use both the offline and online Generator with ColdFusion. As described, the Online Generator is a Web server component for creating Shockwave content dynamically. This allows us to pass to the SWT file parameters for any variables that we set in the movie.
First I created our HTML page.
<html>
<body bgcolor="#FFFFFF">
<head>
<title>Untitled Document
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<form method="post" action="out.cfm" name="">
<table width="75%" border="0">
<tr bordercolor="#FFFFFF" bgcolor="#CCFFFF">
<td>Enter your name:
<input type="text" name="text">
<input type="submit" name="Submit" value="OK">
</td>
</tr>
</table>
</form>
</body>
</html>
This is a simple HTML page for sending some text to our SWT file. Next I created our CFM page to process that data and pass it to the SWT file.
<cfparam name="text" default="world">
<cfset text=URLEncodedFormat(text)>
<html>
<body bgcolor="#FFFFFF">
<head>
<title>Generator CF</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>
<div align="center"><object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#3,0,0,0" width="200" height="200">
<param name="SRC"
value="mov.swt?text=<cfoutput>#text#</cfoutput>">
<embed
src="mov.swt?text=<cfoutput>#text#</cfoutput>"
pluginspage="http://www.macromedia.com/shockwave/download/"
type="application/x-shockwave-flash" width="200" height="200">
</embed>
</object> </div>
</body>
</html>
mov.swt?text=<cfoutput>#text#</cfoutput>
Offline Use
Since Offline Generator is a command-line-driven program, how can we use it from within our Web pages? Well, you're faced with two choices: use a CFM tag for executing command-line programs or use the CFM_Generate tag.
The aim is to execute the Offline Generator, and the CFM_Generate tag makes this a bit easier to do. The tag comes precompiled with the ColdFusion Generator SDK that is freely available to download from the Macromedia Web site (www.macromedia.com/software/generator). Once installed, it allows you to execute the Offline Generator from within your ColdFusion pages. Full instructions do come with the SDK, but to demonstrate, here is sample code.
<CFX_Generate
This is the same as using:
Generate -swt myfile.swt myfile.swf
at the command line.
TEMPLATE="c:\webroot\myfile.swt"
TYPE="swf"
FILE="c:\webroot\myfile.swf">
Summary
I have shown some simple uses of Generator and how you can start to use your ColdFusion code with it. The sky really is the limit with Generator, and the results can be astounding.
Published October 18, 1999 Reads 6,743
Copyright © 1999 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Andrew Stopford
Andrew Stopford is a Web developer and
consultant from south Manchester in the UK and a Macromedia
evangelist for Generator. He has lent his hand to many Generator sites around the world. Andrew's kept busy answering questions that the Generator community posts in the Macromedia Generator NG and other information sites. He's also the creator of Kimmuli, a code tool for Generator.
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe Fiddles with its Web Apps
- Adobe & Salesforce Cut Cloud Deal
- Hosting.com Launches ColdFusion 9 in the Cloud
- The Real Time Infrastructure Ultimatum
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF




























