Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

10 Minutes with Flash: Creating a Custom Panel

  • Print
  • + Share This
Do you sometimes wish there was a Flash panel to access online resources such as the Macromedia Flash Exchange and FlashKit? Well, now there is. In only 10 minutes, Robert Hoekman, Jr. shows you how to create a custom panel that pulls up Flash tutorials faster than you can say "Resources."
From the author of

Flash MX 2004 has a lot of panels, but sometimes I wish there was one for accessing online resources such as the Macromedia Flash Exchange and FlashKit. That way, I could just jump to those sites from within Flash. It's just too much work to open a browser window and type in a URL. So I decided to make my own panel and add it to my custom panel set. Then it occurred to me that this would make a good topic for an article.

This panel won't be some elaborate panel that serves up search results from FlashKit because I have only 10 minutes to show you how to build it, but this tutorial will reveal how to get started if you decide to make some custom panels of your own.

Just Another Flash Movie

The secret to making a custom panel is to know that a panel is really just another Flash movie. In other words, you'll make a simple movie with a couple of buttons in it and save it to a specific folder in the Flash install directory.

To create the movie:

  1. Create a new Flash document and save it as Resources_panel.fla. You can save it wherever you want.

  2. Change the stage dimensions to 210x150. This is somewhat arbitrary because the panels built into Flash have varying sizes, but when panels are docked, they are typically about 210 pixels wide (give or take, depending on your particular panel layout).

  3. Rename Layer 1 to buttons.

  4. Add a new layer to the timeline named actions.

  5. On the buttons layer, use the Text tool to type Flash Exchange on the stage.

  6. Convert the text to a Button symbol named exchange button. You can edit the button's Over, Down, and Hit states if you like, but it's not necessary.

Next, as with any other button in any other movie, you need to write some ActionScript that tells the button what to do. In this case, you want the button to launch your browser and open the Macromedia Flash Exchange (an online resource for Flash extensions and components). First, however, you should to set a few properties for the movie so the panel acts like a panel instead of a Flash movie. To make this happen:

  1. Select frame 1 of the actions layer and open the Actions panel.

  2. In the Actions panel, add a stop() command:

  3. stop();
  4. Next, add the following code:

  5. Stage.align = "LT";
    Stage.scaleMode = "noScale";
    Stage.showMenu = false;

This script tells Flash to align everything in the movie to the left side of the stage, prevent scaling, and hide the contextual menu. Why add this code? We do this because a panel can be scaled within Flash, and we want to keep things organized. Without the preceding code, the contents of the panel would shift positions.

Next, you need to finish setting up your buttons. To do this, you can write the script that tells the exchange button instance what to do; then create a second button that opens the FlashKit web site.

  1. Select the exchange button instance and assign it the instance name exchange_btn via the Properties panel. We need the instance name to target the button through ActionScript.

  2. To use the button to launch the Flash Exchange, add the following script to frame 1 of the actions layer:

  3. exchange_btn.onRelease = function() {
        getURL("http://www.macromedia.com/exchange/flash");
    };
  4. Create the FlashKit button by typing FlashKit on the stage and converting the text to a Button symbol.

  5. Assign the new button the instance name flashkit_btn.

  6. Add the following code to frame 1 of the actions layer to make the button launch FlashKit.com in a web browser:

  7. flashkit_btn.onRelease = function() {
        getURL("http://www.flashkit.com");
    };

Your completed ActionScript should match Figure 1.

Figure 1Figure 1 The completed script for the Resources panel.

If you want to add more buttons to this panel later on, just follow the preceding steps. For now, though, we'll move on to publishing the movie as a panel.

  • + Share This
  • 🔖 Save To Your Account