Accessibility

Flash Article

 

Using Flash MX 2004 for the First Time – Part 1: Building a Banner

Jen deHaan

Flash Authoring QE
Adobe
Jen deHaan's blog
flashthusiast.com
webvideoblogger.com

Macromedia Flash can seem like a very complex program to learn. One reason for this seeming complexity is that you can use it for so many different things, such as cartoon animations, media players, and sophisticated software. This tutorial is suitable for you if you're opening Flash for the first time. It shows you some of the fundamental aspects of the program, and how to get started using them to build a real project. You don't need to know anything about Flash or animation to complete this tutorial; in fact, you'll discover how easy it is to start using Flash to add elements to your web pages.

This is part one of a three-part article on how to build a simple animated banner in Flash and add it to a web page using Macromedia Dreamweaver. You'll learn how to create a file and modify its settings, import and add graphics to the Stage from the library, and create layers in part one. In parts two and three you'll add an animation and create a button that opens a browser window. Then you'll specify publish settings, and add the banner to a web page.

Note: This article has been updated for Flash 8.

Requirements

To complete this tutorial you will need to install the following software and files:

Macromedia Flash MX 2004

OR Macromedia Flash MX Professional 2004

Tutorials and sample files:

Prerequisite knowledge:

None whatsoever.

Creating a New Document

You can create all kinds of different elements for the web or for CD-ROMs and devices using Flash. First, you create a file in the Flash authoring tool, which you use to output SWF files. SWF files are the files that you can put online when you embed it in a web page. The Macromedia Flash Player plug-in then displays the SWF file, so your website visitors can view or interact with the content.

Your SWF file can contain video, MP3 sound, animations, images, data, and so forth. The benefit of using an SWF file over other formats is that the Flash Player plug-in is incredibly common. Let's get started building a banner.

  1. Open the Flash application.

    By default, Flash displays the Start Page (see Figure 1), which enables you to select a recently edited document, create a new Flash document (or other documents if you use Flash MX Professional), or create a new document using a pre-built template.

    By default, Flash displays the Start Page when it is launched. This figure shows the options available in Flash MX Professional.

    Figure 1: By default, Flash displays the Start Page when it is launched. This figure shows the options available in Flash MX Professional.

  2. Click Flash Document from the Create New column on the Start Page to create a blank document. If Flash doesn't display the Start Page (the feature might have been disabled earlier if you share a computer) you can select File > New from the main menu to create a new document. Make sure the General tab is active, select Flash document, and click OK.
  3. Select File > Save As from the main menu. Name the file banner.fla and click Save when you're done. Flash saves editable documents as FLA files. From the FLA document, you export (or compile) SWF files that you can embed in an HTML page. Flash Player, installed on most computers, plays the SWF files that you export from Flash.

It's a good idea to save a new document when you start working with it (and often thereafter) so you don't lose any of your hard work. After you finish saving the file, proceed to the following exercise where you will change the document's properties.

Changing Document Properties

At this point you're looking at a blank canvas surrounded by many controls (see Figure 2). The large white square is called the Stage, and it's where you place assets you want to display in the SWF file, such as images, buttons, text, or animations. The Stage and panels are commonly called the Flash workspace or authoring environment.

The Flash authoring environment includes a Stage where you can place and manipulate assets.

Figure 2: The Flash authoring environment includes a Stage where you can place and manipulate assets.

Around the Stage you see a variety of panels. The panel on the left is called the Tools panel (see Figure 3). This panel includes tools you can use to create and modify documents, such as tools you use to draw and make selections.

 Use the Tools panel to draw and make selections. You use the Selection tool (the black arrow) to make selections in these tutorials.

Figure 3: Use the Tools panel to draw and make selections. You use the Selection tool (the black arrow) to make selections in these tutorials.

A panel near the bottom of the Flash application is titled Properties. (Select Window > Properties if you don't see the panel.) This panel is called the Property inspector (see Figure 4). This panel enables you to change various properties whatever is currently selected in your document (such as an image or a frame), or set properties for the entire SWF file (such as the frame rate or dimensions). If you don't have any objects or frames selected, the Property inspector allows you to modify properties for the document itself.

  1. Open the Property inspector (Window > Properties) and click the button next to the text that says Size to open the Document Properties dialog box.

    Note: Make sure you don't have a frame selected. Click the Stage if you don't see this button.

    Click this button in the Property inspector to open the Document Properties dialog box. You can then change the size and color of the Stage.

    Figure 4: Click this button in the Property inspector to open the Document Properties dialog box. You can then change the size and color of the Stage.

    The button displays the current dimensions of the FLA file (550 x 400 pixels). By default the Stage size in a new Flash document is 550 pixels wide by 400 pixels high. When you click this button, you open a dialog box where you can change several document-wide properties (such as the Stage dimensions, color, and document frame rate).

  2. Type 160 into the Width text box, and 600 into the Height text box.

    When you type new values into these text boxes, you resize the dimensions of your FLA document. There is a reason that you need to use these specific dimensions. Because you're creating a banner, you should use a standard banner size. In this tutorial, you're creating a "wide skyscraper." For a list of standardized banner sizes, check out the Interactive Advertising Bureau's page on Interactive Marketing Units, or search recommended dimensions in the Flash Help panel (F1).

    Note: You can also create banners from a Macromedia template by selecting File > New from the main menu. Select the Templates tab and choose the Advertising category.

  3. Click OK when you finish entering the new dimensions to return to the authoring environment.

    When you return to the authoring environment, notice how the dimensions of your document change. You can also change the current document's background color and frame rate directly in the Property inspector, without going to the Document Properties dialog box. You'll find information about frame rate in part 2 of this tutorial.

Remember to save your work (File > Save) before you continue.

Importing Graphics

When you work with Flash, you'll often import assets into a document. Perhaps you have a company logo, or graphics that a designer has provided for your work. You can import a variety of assets into Flash, including sound, video, bitmap images, and other graphic formats (such as PNG, JPEG, AI, and PSD).

Imported graphics are stored in the document's library. The library stores both the assets that you import into the document, and symbols that you create within Flash. A symbol is a vector graphic, button, font, component, or movie clip that you create once and can reuse multiple times.

So you don’t have to draw your own graphics in Flash, you can import an image of a garden variety gnome from the tutorial source file. Before you proceed, make sure that you download the support files for this article (if you haven't done so already) from the Requirements section, and extract the images to the same directory as your banner.fla document.

  1. Select File > Import > Import to Library to import an image into the current document.

    You'll see the Import dialog box (see Figure 5), which enables you to browse to the file you want to import.

     Browse to the folder on your hard drive that contains an image to import into your Flash document.

    Figure 5: Browse to the folder on your hard drive that contains an image to import into your Flash document.

  2. Navigate to the directory where you extracted the support files, select the gnome.png image, and click Open (Windows) or Import (Macintosh).

    The image is imported into the document's library.

    Note: You can drag assets from the library onto the Stage several times if you want to see several instances of the artwork. Your file size doesn't increase if you use several instances on the Stage. The SWF file only stores the information of the original symbol or asset from the library, and treats each instance like a duplicate.

  3. Select Window > Library to open the Library panel.

    You'll see the image you just imported, gnome.png, in the document's library.

  4. Select the imported image in the library and drag it onto the Stage.

    Don't worry about where you put the image on the Stage, because you'll set the coordinates for the image later. When you drag something onto the Stage, you will see it in the SWF file when the file plays.

  5. Click the Selection tool, and select the instance on the Stage.

    If you look at the Property inspector you'll notice that you can modify the image's width and height, as well as the image's X and Y position on the Stage. When you select an object on the Stage, you can see and modify the current coordinates in the Property inspector (see Figure 6).

    The X and Y coordinates match the registration point, which is the upper left corner of this movie clip symbol.

    Figure 6: The X and Y coordinates match the registration point, which is the upper left corner of this movie clip symbol.

  6. Type 0 into the X text box, and type 0 into the Y text box. Doing this sets the X and Y coordinates both to 0, as shown in Figure 7.

    Set the X and Y coordinates using the Property inspector. Set the X and Y values to 0.

    Figure 7: Set the X and Y coordinates using the Property inspector. Set the X and Y values to 0.

    Setting new coordinates moves the upper-left corner of the image to the upper-left corner of the Stage. You can drag the bitmap image around the Stage using the Selection tool instead of changing coordinates in the Property inspector. You should use the Property inspector when you need to set a specific position for an object, like you did in this step.

Remember to save the document before you proceed to the next exercise.

Note: You can also import sound files into your FLA documents. This isn't covered in this tutorial, but you can find out more information if you search importing sounds in the Help panel (F1).

Introducing Layers and the Timeline

The Timeline panel is above the Stage. The Timeline helps you organize assets in your document, and also controls a document's content over time. To help control content, the Timeline contains layers and frames. Flash documents can play over a length of time, like movies or sound, which is measured using frames. Layers are like transparencies that stack on top of one another, and each layer can contain images, text, or animations that display on the Stage. You'll learn more about frames and the Timeline in part two of this tutorial.

The FLA document you're working on has one layer (Layer 1) with contents on a single frame (frame 1). This is the default way that a Flash document opens.

In this exercise, you lock and rename Layer 1. Often you'll want to place objects in a particular position on the Stage. To help you keep those objects in place, Flash enables you to lock layers, so you cannot select the items on a layer and accidentally move them.

  1. Select Layer 1 in the Timeline and click the dot below the lock icon, as shown in Figure 8.

    Lock a layer so its contents aren't accidentally moved or deleted from the Stage. You can also prevent inadvertently adding other assets to that layer.

    Figure 8: Lock a layer so its contents aren't accidentally moved or deleted from the Stage. You can also prevent inadvertently adding other assets to that layer.

    With your only layer locked, you need to add new layers before you can add any other objects to the Stage. You cannot add new objects to a locked layer.

  2. Select the Selection tool in the Tools panel, and double-click the name Layer 1.

    When you double-click a layer name, you can modify the name of the layer.

  3. Type background into the layer name to rename the layer. Then save your file.

    When you start building projects with many layers, layer names like Layer 1 and Layer 14 don't help you determine what's on that layer. Giving layers a descriptive name is a good practice to adopt.

Tip: You can also organize layers into layer folders. For more information, search layer folders in the Help panel (F1).

Creating a New Layer

In just about any Flash project where you use imported graphics and animation, you'll need to create at least a few layers. You need to separate certain elements onto their own layers, particularly when you start to animate objects. You can also stack graphics on top of each other, and even create a sense of depth or overlapping by using multiple layers.

  1. Select the background layer on the Timeline, and click the Insert Layer button to create a new, empty layer.

    The new layer is created above the background layer (see Figure 9).

    Click Insert Layer to insert a new layer above the currently selected layer.

    Figure 9: Click Insert Layer to insert a new layer above the currently selected layer.

  2. Double-click the name of the new layer so the layer's name becomes editable.
  3. Type animation to rename the new layer.

    Graphics on the Stage stack according to the layers on the Timeline. For example, anything that you put on the animation layer will appear above the image on the background layer. You will add animation to this second layer in part two of this tutorial.

Make sure that you save your progress before moving on.

Tip: If you need to reorganize your layers you can use the Selection tool to select and drag a layer above or below other layers on the Timeline.

Importing to a Layer

In an earlier exercise, you imported the gnome.png image directly into the document's library. Then you dragged the image onto a selected layer on the Stage. You can also import assets directly to the Stage instead of into the library. First you need to select the frame into which you want to import the image on the Timeline. Then you can import the image onto that frame, which displays on the Stage. You use this technique to import an image in the following exercise.

  1. Select frame 1 of the animation layer.

    You need to import star.png image to the animation layer.

  2. Select File > Import > Import to Stage.

    The Open dialog box appears where you can select an image from your hard drive. Find the folder of this tutorial's source files on your hard drive.

  3. Select star.png in the tutorial's source files, and click Open (Windows) or Import (Macintosh). The image imports to the animation layer (see Figure 10), and then it appears on the Stage.

    he image imports to the frame on the layer that you select on the Timeline. You will learn more about the Timeline and layers in part 2 of this tutorial.

    Figure 10: The image imports to the frame on the layer that you select on the Timeline. You will learn more about the Timeline and layers in part 2 of this tutorial.

  4. Open the Library panel (Window > Library).

    The image you just imported to the Stage also appears as an asset in the library. Even if you import an asset directly to the Stage, Flash always stores the assets you import in the library as well.

  5. Click the Selection tool in the Tools panel.
  6. Move the star.png file on the Stage to just above the gnome's head in the image, as shown in Figure 11.

    Move the star.png just above the gnome's head.

    Figure 11: Move the star.png image just above the gnome's head.

  7. Select File > Save to save your document before moving on.

Test Your Progress

To finish, you can test your document in Flash. This tests the SWF file in Flash Player. For example, you can see how your code works in Flash Player, how animations play on the Timeline, test user interactivity, and more. It's much faster than uploading your work to a server each time you want to see the SWF file in action.

  1. Select Control > Test Movie from the main menu.

    The test environment opens and plays your document in Flash Player. You can now see the compiled SWF file version of your FLA document. You will often use the Test Movie command to view your progress when you work on an FLA file.

  2. Click the banner.fla document tab (Windows) or the SWF file's close button (Macintosh) to return to the authoring environment.
  3. Find the folder on your hard drive where you saved banner.fla at the beginning of this tutorial.

When you open this folder, you should see an additional SWF file called banner.swf in the folder. This is the compiled version of the banner.fla document. When you want to create a finished version of your file to upload, you'll want to make additional publish settings in Flash before you compile your SWF file. You'll look at these settings in part three of this tutorial.

Where to Go from Here

In a very short period of time, you have set up an FLA document, imported and arranged assets in an FLA file, created and modified layers, and tested a SWF file. You're on your way to creating a banner in Flash so you can embed it in an HTML page using Dreamweaver. In parts one and two of this tutorial, you will create and modify symbols, create an animation, add some simple ActionScript for a button that opens a web page, and add the banner to a website.

To see the completed file for this part of the tutorial, find banner1_finish.fla in the folder of source files that accompanies this tutorial.

To continue on to Part 2, see Using Flash for the First Time – Part 2: Adding Symbols, Animation, and ActionScript.

About the author

Jen deHaan was raised by wolves in the deep woods of the Canadian north. Canada's chief exports include motor vehicles (or their parts), lumber, newsprint, nonmetal materials, and wheat. One overcast day in 2004, Jen left her life as a Flash deseloper (designer/developer) in Canada to write Flash documentation and samples at Macromedia in San Francisco. Aside from her ongoing work at Adobe as an instructional designer for web and video products, Jen runs several community sites for fun, and maintains a blog at www.webvideoblogger.com and weblogs.macromedia.com/dehaan. She believes that _root tends to be evil and misses Tim Horton's coffee.