Accessibility
Adobe
Sign in Privacy My Adobe

Migrating from Flash 8 to Flash CS3 Professional


Table of Contents

New ActionScript 3.0 components

Flash 8 had what were called the V2 components. These were largely the same as the V2 components in Flash MX 2004, and both sets of components used ActionScript 2.0. Flash CS3 introduces support for ActionScript 3.0, and with that comes a new set of components called the ActionScript 3.0 components.

Note: For information on new FLVPlaybackCaptioning component, see Enhancements to using video in Flash.

If you're using ActionScript 2.0, the V2 components are still available. You must create an ActionScript 2.0 FLA file, and then you'll find the V2 components in the Components panel.

You also find the new ActionScript 3.0 components in the Components panel (as usual). Create a new ActionScript 3.0 Flash document, and then choose Window > Components, and open the User Interface folder (see Figure 41).

ActionScript 3.0 components

Figure 41: A brand-new set of components that use ActionScript 3.0.

These components were entirely rebuilt to be more lightweight and easier to skin than the V2 components in Flash 8. You might notice some new components, and that some components from the previous set are unavailable. New components include the ColorPicker, Slider, and TileList components. You won't find some of the UI components from the V2 set in ActionScript 3.0, but the V2 components are still available when you create an ActionScript 2.0 document.

Note: The Loader component has been renamed UILoader in the ActionScript 3.0 set. This component was changed to help avoid confusion, because the flash.display package now has a Loader class. The component functionality has not changed.

The main difference that you will initially experience is using ActionScript 3.0 to make the components work. The following example shows you the difference between using the V2 components and using the ActionScript 3.0 components. You create exactly the same application in both examples, so you can directly compare the ActionScript 2.0 and ActionScript 3.0 code.

  1. Create a new ActionScript 2.0 FLA file in Flash 8 or Flash CS3.
  2. Drag a Button component and a ScrollPane component from the Components panel (Window > Components) to the Library.

    You're adding instances of the V2 Button and V2 ScrollPane to your document.

  3. Select frame 1 on the timeline and open the Actions panel (Window > Actions), and then type the following code into the Script pane.
    import mx.containers.ScrollPane;
    import mx.controls.Button;
    
    System.security.allowDomain("http://www.helpexamples.com");
    
    this.createClassObject(Button, "myButton", 10, {label:"Load", _x:10, _y:10});
    myButton.addEventListener("click", clickHandler);
    
    var myScrollPane:ScrollPane = this.createClassObject(ScrollPane, "myScrollPane", 20, {_x:10, _y:40});
    
    function clickHandler(eventObject:Object):Void {
           myScrollPane.contentPath = "http://www.helpexamples.com/flash/images/image2.jpg";
    }
        
  4. Select Control > Test movie to test your file.

An image loads into the ScrollPane when you click the button.

Now, lets build the same thing using ActionScript 3.0 code and the ActionScript 3.0 components.

  1. Create a new ActionScript 3.0 FLA file in Flash CS3.
  2. Drag a Button component and a ScrollPane component from the Components panel to the Library.

    You're adding instances of the ActionScript 3.0 Button and ScrollPane to your document.

  3. Select frame 1 on the timeline and open the Actions panel (Window > Actions), and then type the following code into the Script pane.
                 
    import fl.containers.ScrollPane;
    import fl.controls.Button;
    
    var myButton:Button = new Button();
    myButton.label = "Load";
    myButton.x = 10;
    myButton.y = 10;
    myButton.addEventListener(MouseEvent.CLICK, clickHandler);
    addChild(myButton);
    
    var myScrollPane:ScrollPane = new ScrollPane();
    myScrollPane.move(10, 40);
    addChild(myScrollPane);
    
    function clickHandler(event:MouseEvent):void {
           myScrollPane.source = "http://www.helpexamples.com/flash/images/image2.jpg";
    }
        
  4. Select Control > Test movie to test your file.

    An image loads into the ScrollPane when you click the button.

So now that you know the difference between components in Flash 8 and Flash CS3, you are ready to get started using them. To learn more about how to use components, use the Using ActionScript 3.0 Components book in Flash Help.

For video tutorials about using the new ActionScript 3.0 UI components, see Using Components, Writing ActionScript for components, and Creating a simple application with components, all by the talented and stylish Buck DeFore of Adobe. There are also Flash Quick Starts available on the new components in the Flash Developer Center.