Using Generator Templates in Production Flash

So far, you have learned how to create Generator Templates and preview their look and feel by viewing the static .SWF file that Flash 5 creates for you. We have not discussed how to actually implement .SWT files into a live production environment. In this section, you learn to use Generator Templates in HTML and in other Flash movies.

Publishing Generator Templates (.SWT files)
If you add a Generator Object or set a Generator environment variable, then a Generator Template (.SWT file) will automatically be created whenever you publish your Flash movie. If you are using dynamic graphics or data sources, then you will need to publish a .SWT file and upload it to your Generator Server. You can select a Generator Template file in the Publish Settings dialog (File➪Publish Settings), and define its settings in the Generator tab. Most of these settings mirror those found in the Flash format tab of the Publish Settings dialog and the Movie Properties (Modify➪Movie) dialog.

The Generator Template format settings in the Publish Settings dialog.

The Generator Template format settings in the Publish Settings dialog.

You can specify the width and height (in pixels) of the Flash movie that will be created from the Generator Template. If Match Movie is checked (the default), then the width and height will reflect the current settings in the Movie Properties dialog (Modify➪Movie).

This option enables you to enter a hexadecimal value for color, or select a color from the pop-up color chip menu. Note that you can also type Web-safe color names into this field, such as blue, black, or white.

Frame Rate
In this field, you can enter a frame rate that differs from the setting in the Movie Properties dialog. The frame rate controls how fast the Flash movie is played. The higher the frame rate, the faster the movie plays.

Load Order
This option controls how the layers in a Flash movie load into the Flash Player. The default setting, Bottom up, loads the lowest layer first and progressively loads higher layers. You can also choose Top down, which loads the highest layer first and then progressively loads lower layers.

Data Encoding
From this drop-down menu, you can select the data encoding method used for your Generator data sources. The Default option uses the data encoding for the operating system with which you are using the Flash authoring application. Most data sources use ASCII encoding (the standard encoding for Windows and UNIX text). If you’re using the Mac version of Flash, the Default option is the same as selecting MacRoman encoding. UTF8 is version of Unicode encoding, and is used by many applications. SJIS (a Japanese character encoding) and EUC_JP (Extended UNIX Code for Japanese) are available for data sources that use Japanese text.

Create External Font
This check box creates .FFT files with your published Generator Template (.SWT file). Each typeface (font) that you use in Static, Dynamic, or Input Text will be saved in a separate file. These font files should be in the same directory as the .SWT file on the Generator-enabled Web server. If you use Generator variables in Flash text, then you should always create external font files.

External Media
With this setting, you can choose one or more .SWT files, whose symbols can be referenced by the current Flash movie you are authoring. By linking to external media in other .SWT files, you can create custom symbols in Flash template “libraries” and use those symbols in multiple Generator Templates.

You can test Generator environment variables by adding them in the Parameters area of the Generator tab. Type the variable’s name and value into the provided text fields, and click the Add button. When you publish the .SWT file, the accompanying SWF file will show the Generator variable in use, as if a live Generator Server served it. Note that you should only use these area of the Generator tab to test Generator environment variables use standard data sources for live Web delivery.

Using Generator Templates in HTML
Quite simply, you refer to Generator Templates in HTML <EMBED> and <OBJECT> tags just as you would any other .SWF file. You can also use the HTML templates in Flash 5 to automatically publish the HTML required to use a Generator Template. To create an HTML document that uses the Generator Template (.SWT file), follow these steps:

  1. pen the Publish Settings dialog, and check HTML in the Format tab.
  2. In the HTML tab, choose Generator Only (Default) in the Template drop-down menu. Also, if you want the returned Flash .SWF to scale to fill the Web browser window, then select Percent in the Dimensions drop-down menu. The width and height values automatically change to 100 percent.
  3. Click the Publish button in the Publish Settings dialog. Flash publishes three files: the .SWF file, the .SWT file, and the HTML file. You only need to upload the .SWT and HTML files to your Generator-enabled Web server.
  4. If you open the HTML document that Flash 5 publishes for you, you’ll notice that it refers to the .SWT file instead of the .SWF file (the formatting of the following code has been modified to fit this page; the ¬ character denotes a continuation of the same line of text):

    You’ll see that Flash also inserts a query string (a question mark followed by URL form-encoded text) after the .SWT file name, as in:


The ?type=swf is the query string appended to the Generator Template name.When the Generator Server receives the request for the basicList.swt Template file, it will see the type=swf string. It then returns a .SWF format file to the Web browser. The types are:

  • type=swf, which returns a .SWF file.
  • type=jpg, which returns a .JPEG image. Use an <IMG> HTML tag instead of an <OBJECT> or <EMBED> tag, with the Generator Template listed as the value of the SRC attribute. If you choose the Generator Image Output Template in theHTML tab of Publish Settings, then Flash will automatically create the appropriate HTML formatting.
  • type=gif, which returns a .GIF image. See the preceding .JPEG description.
  • type=png, which returns a .PNG image. See the preceding .JPEG description.
  • type=mov, which delivers a QuickTime Flash movie to the Web browser. If you use this query string manually, then make sure that you use the <EMBED> tag to call the .SWT template file. The Generator QuickTime HTML Template automatically creates the appropriate formatting for you.

Using Generator Templates in other Flash movies
You can also load Generator Templates into other Flash .SWF files. You don’t actually even download the .SWT file itself (as mentioned earlier) Generator creates a .SWF file from the .SWT request, and delivers that new .SWF file to the Web browser or the Flash movie that requested it. You can use the loadMovie() action to incorporate other .SWF files into a “master” .SWF file. Likewise, you can load Generator content into any Flash movie, such as:

loadMovie(“basicList.swt”, “movieHolder”);

which loads the .SWF output from the basicList.swt file into the Movie Clip instance named movieHolder. And just as you can pass variables with HTML to Generator Templates, you can send establish data sources directly in Flash movies with the loadMovie() action:

firstName = “Robert”; loadMovie(“welcome.swt”, “movieHolder”, “GET”);

This sends the following query string to our Generator Server:


You may recall from our earlier discussions, that the GET method appends Name/Value pairs to the end of the requested URL. You could also send a Generator data source as:

which omits the GET option from the loadMovie() action. Because the variable is declared in the actual URL option, we do need to have Flash add the query string for us. This method is useful if you only want to send specific variables on the current Flash timeline. The previous loadMovie() method would send any and all Flash variables declared on the current timeline.

You can try this loadMovie() method with a Generator Template that uses an MP3 Object. In the Generator Template file, select the MP3 Object and, in the Generator Panel, set its Data Source to {soundURL}. Save the Flash file (.FLA file) and publish a .SWT file (for example, mp3.swt). Then, in a separate Flash movie (a .FLA file) one in which you want to load the Generator Template add the following actions on a keyframe or Button instance:

Make sure that you have a Movie Clip instance named movieHolder on the current timeline. When these actions are executed in the Flash movie, a request will be made for the Generator Template called mp3.swt. Generator will see the soundURL string, and fill in the Data Source for the MP3 Object in the mp3.swt file. It will retrieve the MP3 file named sound_1.mp3 in the data folder on the server, and return a custom .SWF to the movieHolder instance in the original .SWF file. The next expert tutorial by premiere Generator expert Mike Jones shows you another way to use loadMovie actions in a Flash movie, so that you can load images from your Webcam.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Flash Topics