Optimizing Flash Content for Use in Video

By: Tom Green , David Stiller ,

Page 1 of 4

Set for printing

Next

As you may have surmised when reading the heading for this exercise, you are not going to be thinking "outside the box", but thinking outside of the room where the box is located.

This may come as a bit of a surprise, but Flash is often used to create animated cartoons that are shown on television and animations used in commercials. The process has historically been, to say the least, convoluted, but it could be done. The problem was, even though Flash could output to QuickTime, only the main timeline could be exported. Library content, ActionScript-driven animation, and even nested movieclips were not exported. When you consider the fact that the maximum length for the Flash timeline is just over 16,000 frames, the achievement of a short 10-minute cartoon was not possible unless the movie was broken into pieces and stitched together in a video editing program.

Flash CS3 contains a really cool feature that allows you to not only export the content on the timeline, but also create animations that are solely driven by ActionScript as QuickTime movies and then use them as motion graphics in such applications as Adobe After Effects CS3. In fact, in this exercise, the stage is blank. All of the letters that appear in this animation will be randomly generated, colored, and put in motion using ActionScript.

Follow these steps to create a QuickTime movie in Flash:

  1. Open a new Flash document and set the stage color to black.
  2. Rename Layer 1 as scripts.
  3. Select the keyframe in the scripts layer and open the ActionScript Editor.
  4. Enter the following code:

    var t:Timer = new Timer(50, 0);
    t.addEventListener(TimerEvent.TIMER, createLetter);
    t.start();
    function createLetter(evt:Event):void {
    var f:TextFormat = new TextFormat();
    f.size = randomBetween(80, 120);
    f.color = Math.floor(Math.random() * 16777216);
    var mc:MovieClip = new MovieClip();
    var t:TextField = new TextField();
    t.autoSize = "center";
    t.text = String.fromCharCode(randomBetween(97, 122));
    t.setTextFormat(f);
    mc.addChild(t);
    mc.x = (Math.random() * stage.stageWidth);
    mc.y = stage.stageHeight;
    mc.ang = 0;
    mc.range = randomBetween(4, 20);
    addChild(mc);
    mc.addEventListener(Event.ENTER_FRAME, shimmy);
    }

The first line of code creates a timer that tells Flash to create a new Timer object—new Timer(50, 0) —which will wait 50 milliseconds before adding another letter, and that the sequence repeats forever. The next line creates the listener that will "listen" for this virtual "beep" every 50 milliseconds, and when it hears the beep, it will create a random letter. The third line— t.start(); — is the method of the Timer class that starts the clock running. The createLetter() function is how the letters arrive in the movie. The first variable creates a TextFormat object, which is used to format text fields.

Page 1 of 4 1 2 3 4 Next


download
Download Support Files


Downloads are disabled during your trial period.


Keywords
Flash, QuickTime, Actionscript, Flash CS3