Bookmark now!

AddThis Social Bookmark Button

Most popular

The most viewed tutorials in April:

  1. Best dynamic image gallery
  2. Loading external JPG images
  3. Ultimate preloader

Advertisements

Amazing video loops, stunning photo galleries, video and audio players ready to go! Smooth, amazing flipNavigation system!

Create a Flash ad banner with random color stripes effect and time-limited animation

In this easy lesson made for Flash MX, Flash MX 2004 and Flash 8 I will show you how to create a Flash banner ad that fits specific needs of the website it will be displayed on. The unique behaviour of this banner is that it will perform a random display of colored stripes for 9 seconds, after which it will come to a standstill.

Some websites have rules for advertisers who want to show their banner ads, specifying the duration of the animation in a banner. This is made so that the users don't get bugged and visually distracted while they are reading the page which contains the banner. A user will see the animation, judge by herself if she will click the banner or not anyway. After that, stopping the animation makes the website containing it more user friendly.

Have a look at the example banner below: eoll your mouse over it to see what happens. If you missed the random color stripes effect, just hit the Refresh button on your browser and you'll see it.

There are quite a few websites (especially portals) which will place the aforementioned requirements upon the advertiser, who will in turn pass these specifics to you, the Flash designer. I will show you:

Importing the image for the ad banner and converting it into a movie clip symbol

1. In Flash, select File > New. The New Document dialog window will open. Click on the Templates tab. Click on Advertising in the left column and then click on 468x60 (Banner) in the right column. Click OK.

Select Modify > Document and change the Frame rate to 24 fps. Click OK.

2. Call the first layer image.

Naming the first layer in Flash.

3. Right-click on the image below and select Save image as... and save it on your computer in a place where you'll quickly find it.

The image that is going to be used in this tutorial.

4. Select File > Import > Import to Stage, find the image you just saved (bannerpic.jpg), select it and click Open. It will appear on the stage of your Flash document.

5. Click on the image with the Selection tool (V) to select it. Go to the Property inspector below the scene and find the X and Y fields on its left side. Enter 0.0 in both fields.

Manually adjusting the position of the image on the stage.

This will center the image on the stage, both horizontally and vertically. I have made the dimensions of the image equal those of the stage on purpose, so that the ad banner looks as best as it can.

6. While the imported bitmap is still selected, select Modify > Convert to Symbol. In the dialog that appears, choose Movie clip as type, call it image and click OK.

Converting the image into a movie clip symbol.

7. Right-click on frame 2 on the timeline and select Insert Keyframe from the menu that appears. Your timeline will now look like this:

A second keyframe has just been added to the image layer's timeline.

8. Right-click on frame 6 and select Insert Frame. This will prolong the duration of the second keyframe and the timeline of the image layer will now look like this:

A frame has been inserted into frame six.

9. Go back to the first keyframe by clicking on it.

Selecting the first keyframe.

10. Click on the image movie clip on the stage once to select it. In the Property inspector, find the Color menu on its right side, select the Alpha option and turn it down to 0 (zero).

Lowering the Alpha property of the image movie clip to the lowest possible value.

Now, why was all of this done? First, because the image will be loaded before the random colored stripes begin their animation, so it must not be visible — you want the stripes to appear first, so that is way you lowered its Alpha property (transparency) to zero. And second, you have added keyframes and frames to the timeline of the image layer because you will make the banner check the elapsed time to see when the nine seconds have passed. Once this turns out to be true, the banner will stop the playhead from going forward and the animation will stop.

Top of page

Creating an empty movie clip

11. Lock the image layer. Create a new layer and call it colors. This new layer will automatically have the same duration (in the timeline) as the previous layer, which is fine, because you need it to be so.

The new colors layer will hold inside itself the colored stripes.

12. Select Insert > New Symbol. The Create New Symbol dialog will appear. Just be sure to select Movie clip as type, call it empty movie clip and click OK. Take a look above the layers: Flash informs you that you are now working inside the new empty movie clip movie clip symbol you have just created.

Working inside the new movie clip symbol.

13. Click on the Scene 1 link to return to the main timeline.

Going back to the main scene in Flash.

By doing this, you are effectively creating an empty movie clip, because you haven't drawn anything inside it. This is precisely what you need - an empty movie clip, which will serve as the container for the colored stripes that will be loaded into it from the Library at runtime (at runtime means while your movie — the ad banner is running).

14. Select Window > Library to open the Library panel. You will find here all the symbols that you have created so far, image and empty movie clip, along with the imported JPG image, bannerpic.jpg.

All the symbols are stored inside the Flash Library.

15. Click and drag an instance of empty movie clip onto the stage. Since this is a movie clip with no contents (it is empty), it is represented by its registration point.

The empty movie clip has just been dragged out of the Library onto the stage.

16. While the movie clip is still selected, go to the Property inspector and give it an Instance name: call it container (see 1 in the image below). Then make its coordinates on the stage (X and Y) equal zero.

Assigning an Instance name to the movie clip and positioning it on the stage.

This will place the movie clip in your document's upper left corner, which is a convenient position because this will make the placing of loaded color stripes much easier than if you were to place it in an arbitrary position.

The empty movie clip is placed into the document's upper left corner.

The Instance name is a must if you want to order the empty movie clip to load other symbols from the Library, which you will do later.

Top of page

Creating the main ad message

17. Lock the colors layer. Create a new layer above the existing ones and call it message.

The third layer has been inserted into the document.

18. Select the Text tool (T). In the Property inspector, make the following selections (see screenshot below):

  1. Select Static Text for your text field.
  2. Pick a font you like.
  3. Choose a big font size — after all, this is a banner ad! The message must be clearly visible!
  4. Choose black as color so that you can more easily see the text as you type it. You will change that later.
  5. If you are working in Flash 8, select Anti-alias for animation as the rendering option. This is a must, since you will later export your SWF movie for previous versions of Flash player.
  6. Be sure that the Selectable option is turned off. Selectable text on a Flash ad banner would look lame and possibly the banner would malfunction.

Choosing the options for the text field in the Property inspector.

19. Click on the stage and type the message for your ad banner. When doing an ad banner for a client, this message will most likely be handed down to you from their marketing department, but sometimes they will hire you to make the full banner, including the message and the idea. For the purpose of this tutorial, you can just type "Catch the colors of summer" or anything you like.

Press Esc to exit the text field typing mode. A blue border will show up around your text. Place the text field in the center of your ad banner by moving it around with the arrow keys on your keyboard until it is well positioned.

The ad banner message is included in a static text field.

The blue border comes in handy when the color of the text must be changed to match the background color: your text field is still visible. So do precisely that now:

20. Go to the Property inspector and change the text's color to white. This is done because you will place various color stripes below this field later, via ActionScript, so the message will look good on that kind of background. Black just wouldn't do it, especially for a colorful banner like this one.

The color of the static text field has been changed from black to white.

21. Your text field should still be selected. Now select Modify > Convert to Symbol (shortcut key: F8). Select Movie clip as type, call it ad message and click OK.

22. Assign an Instance name to the new movie clip: go to the Peoperty inspector and type adMessage in the Instance name input field.

The third movie clip was just given an Instance name.

To see how to make an invisible button for your ad banner, please continue to the next page.