View comments | RSS feed

Creating the Dial Flash (FLA) file

The first steps for creating a component include creating the component movie clip within a FLA document file.

To create the Dial FLA file:

  1. In Flash, select File > New and create a new document.
  2. Select File > Save As and save the file as Dial.fla.

    The file can have any name, but giving it the same name as the component is practical.

  3. Select Insert > New Symbol. The component itself is created as a new MovieClip symbol so it will be available through the library.

    Name the component Dial, and assign it the behavior Movie clip.

  4. If the Linkage section of the Create New Symbol dialog box isn't open, click the Advanced button to reveal it.
  5. In the Linkage area, select Export for ActionScript and deselect Export in First Frame.
  6. In the Identifier text box, enter a linkage identifier such as Dial_ID.
  7. in the AS 2.0 Class text box, enter Dial. This value is the component class name. If the class is in a package (for example, mx.controls.Button), enter the entire package name.
  8. Click OK.

    Flash changes to symbol-editing mode.

  9. Insert a new layer. Name the top layer Actions and the bottom layer Assets.
  10. Select Frame 2 in the Assets layer and insert a keyframe (F6).

    This is the structure of the component movie clip: an Actions layer and an Assets layer. The Actions layer has one keyframe and the Assets layer has two keyframes.

  11. Select Frame 1 in the Actions layer and open the Actions panel (F9). Enter a stop(); global function.

    This prevents the movie clip from proceeding to Frame 2.

  12. Select File > Import > Open External Library and select the StandardComponents.fla file from the Configuration/ComponentFLA folder. For example:
  13. Dial extends the UIComponent base class; therefore, you must drag an instance of the UIComponent into the Dial document. In the StandardComponents.fla library, browse to the UIComponent movie clip in the following folder: Flash UI Components 2 > Base Classes > FUIObject Subclasses and drag it to the Dial.fla library.

    Asset dependencies are automatically copied to the Dial library with UIComponent.

    NOTE

     

    When you drag UIComponent to the Dial library, the folder hierarchy in the Dial library is changed. If you plan to use your library again, or use it with other groups of components (such as the version 2 components), you should restructure the folder hierarchy to match the StandardComponents.fla library so that it's organized well and you avoid duplicate symbols.

  14. In the Assets layer, select Frame 2 and drag an instance of UIComponent to the Stage.
  15. Close the StandardComponents.fla library.
  16. Select File > Import > Open External Library and select the DialAssets.fla file.

    For a sample of the DialAssets.fla file, see the Flash Samples page at www.adobe.com/go/learn_fl_samples.

  17. In the Assets layer, select Frame 2 and drag an instance of the DialFinal movie clip from the DialAssets library to the Stage.

    All the component assets are added to Frame 2 of the Assets layer. Because Frame 1 of the Actions layer has a stop() global function, the assets in Frame 2 will not be seen as they are arranged on the Stage.

    You add assets to Frame 2 for two reasons:

  18. Close the DialAssets.fla library.
  19. In the Assets layer, select Frame 1. Drag the BoundingBox movie clip from the library (Flash UI Components 2 > Component Assets folder) to the Stage. Name the BoundingBox instance boundingBox_mc. Use the Info panel to set both the height and width of the DialFinal movie clip to 250 pixels, and the x, y coordinates at 0, 0.

    The BoundingBox instance is used to create the component's live preview and resize during authoring. You must set the size of the bounding box so that it can enclose all the graphical elements in your component.

    NOTE

     

    If you are extending a component (including any version 2 component) you must keep any instance names already in use by that component because its code will refer to those instance names. For example, if you include a version 2 component that is already using the instance name boundingBox_mc, you should not rename it. For your own instance names, you can use any unique name that does not conflict with an existing one within the same scope.

  20. Select the Dial movie clip in the library, and select Component Definition from the Library context menu (Windows: Right-click; Mac: control-click).
  21. In the AS 2.0 Class text box, enter Dial.

    This value is the name of the ActionScript class. If the class is in a package, the value is the full package, for example, mx.controls.CheckBox.

  22. Click OK.
  23. Save the file.

Flash CS3


Comments


Rocket Ron said on Jul 18, 2007 at 9:27 AM :
Is it possible to embed a sound within a component and instantiate it using attachSound from within the component class file ? I have created a MovieClip containing all of my sounds and dragged this MovieClip to the assets frame. When I embed the component within another FLA the sounds don't play.
frebro said on Mar 5, 2008 at 1:28 AM :
On step 12 the path to the StandardComponents.fla file on Macintosh
should be:
HD/Applications/Adobe Flash CS3/Configuration/Component
Source/ActionScript 2.0/FLA/StandardComponents.fla
extdw_doc said on Mar 12, 2008 at 1:58 PM :
True. And the Windows path should be:
C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Component Source\ActionScript 2.0\FLA\StandardComponents.fla

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002485.html