What is Software? | What is Education? | What is Technology? | What is Research? | What is Wi-Fi? | What is Communication? | What is Customer Service?

Free SEO Tutorials & Help

Tutorials:   Adobe Flash   Adobe Photoshop   CorelDRAW   SEO  

Site Map

Website Development | Cable & Broadband Magazine | Solutions for Higher Education | Auction Anything Online

Adobe Flash Help & Tutorials

 Back to Topics

 

What are Components in Flash

About Components

Component categories

Installing components

About version 2 component architecture

Where component files are stored

Version 2 component features

Modifying the component files

About compiled clips and SWC files

Benefits of using components

Accessibility and components

About Components

TOP

Macromedia Flash components are movie clips with parameters that allow you to modify their appearance and behavior. A component can be a simple user interface control, such as a radio button or a check box, or it can contain content, such as a scroll pane; a component can also be non-visual, like the FocusManager that allows you to control which object receives focus in an application.

Components enable you to build complex Macromedia Flash applications, even if you don't have an advanced understanding of ActionScript. Rather than creating custom buttons, combo boxes, and lists, you can drag these components from the Components panel to add functionality to your applications. You can also easily customize the look and feel of components to suit your design needs.

Components are built on version 2 of the Macromedia Component Architecture, which allows you to build robust applications, easily and quickly, with a consistent appearance and behavior. The version 2 architecture includes classes on which all components are based, styles and skins mechanisms that allow you to customize component appearance, a broadcaster/listener event model, depth and focus management, accessibility implementation, and more.

NOTE When publishing version 2 components, you must set your publish settings to publish for ActionScript 2.0 (File > Publish Settings, Flash tab). The version 2 components will not run correctly if published using ActionScript 1.0.

Each component has predefined parameters that you can set while authoring in Flash. Each component also has a unique set of ActionScript methods, properties, and events, also called an API (application programming interface), that allows you to set parameters and additional options at runtime.

For a complete list of components included with Flash Basic 8 and Flash Professional 8, see Installing components. You can also download components built by members of the Flash community at the Macromedia Exchange at www.macromedia.com/cfusion/exchange/index.cfm.

This chapter contains the following sections:

Installing components

Where component files are stored

Modifying the component files

Benefits of using components

Component categories

About version 2 component architecture

Version 2 component features

About compiled clips and SWC files

Accessibility and components

Installing components

TOP

A set of Macromedia components is already installed when you start Flash for the first time. You can view them in the Components panel.

Flash Basic 8 includes the following components:

  • Button component

  • CheckBox component

  • ComboBox component

  • Label component

  • List component

  • Loader component

  • NumericStepper component

  • ProgressBar component

  • RadioButton component

  • ScrollPane component

  • TextArea component

  • TextInput component

  • Window component

Flash Professional 8 includes the Flash Basic 8 components plus the following additional components and classes:

  • Accordion component (Flash Professional only)

  • Alert component (Flash Professional only)

  • Data binding classes (Flash Professional only)

  • DateField component (Flash Professional only)

  • DataGrid component (Flash Professional only)

  • DataHolder component (Flash Professional only)

  • DataSet component (Flash Professional only)

  • DateChooser component (Flash Professional only)

  • FLVPlayback Component (Flash Professional Only)

  • Form class (Flash Professional only)

  • Media components (Flash Professional only)

  • Menu component (Flash Professional only)

  • MenuBar component (Flash Professional only)

  • RDBMSResolver component (Flash Professional only)

  • Screen class (Flash Professional only)

  • Slide class (Flash Professional only)

  • Tree component (Flash Professional only)

  • WebServiceConnector component (Flash Professional only)

  • XMLConnector component (Flash Professional only)

  • XUpdateResolver component (Flash Professional only)

To view the Flash Basic 8 or Flash Professional 8 components:

  1. Start Flash.

  2. Select Window > Components to open the Components panel if it isn't already open.

  3. Select User Interface to expand the tree and view the installed components.

You can also download components from the Macromedia Exchange at www.macromedia.com/exchange. To install components downloaded from the Exchange, download and install the

Macromedia Extension Manager at www.macromedia.com/exchange/em_download/

Any component can appear in the Components panel in Flash. Follow these steps to install components on either a Windows or Macintosh computer.

To install components on a Windows-based or a Macintosh computer:

  1. Quit Flash.

  2. Place the SWC or FLA file containing the component in the following folder on your hard disk:

    • In Windows: C:\Program Files\Macromedia\Flash 8\language\Configuration\Components

    • On the Macintosh: Macintosh HD/Applications/Macromedia Flash 8/Configuration/Components (Macintosh)

  3. Start Flash.

  4. Select Window > Components to view the component in the Components panel if it isn't already open.

Where component files are stored

TOP

Flash components are stored in the application-level Configuration folder.

NOTE For information about these folders, see Configuration folders installed with Flash in Getting Started with Flash.

Components are installed in the following locations:

  • Windows 2000 or Windows XP: C:\Program Files\Macromedia\Flash 8\language\Configuration\Components

  • Mac OS X: Macintosh HD/Applications/Macromedia Flash 8/Configuration/Components

Modifying the component files

TOP

The source ActionScript files for components are located in:

Windows 2000 or Windows XP: C:\Program Files\Macromedia\Flash 8\language\First Run\Classes\mx

Mac OS X: Macintosh HD/Applications/Macromedia Flash 8/First Run/Classes/mx

The files in the First Run directory are copied to your Documents and Settings path when Flash is first lunched. The Documents and Settings paths are:

Windows 2000 or Windows XP: C:\Documents and Settings\username\Local settings\Application Data\Macromedia\Flash 8\language\Configuration\Classes\mx

Mac OS X: Username/Library/Application Support/Macromedia/Flash 8/language/Configuration/Classes/mx

When Flash starts, if a file is missing from the Document and Settings path, Flash copies it over from the First Run directory to your Documents and Settings path.

NOTE If you want to modify the source ActionScript files, modify the ones in the Documents and Settings path. If any of your modifications "break" a component, Flash will restore the original functionality when you close and relaunch Flash by copying the functional file from the First Run directory. However if you modify the files in the First run directory and that "breaks" a component, then you may need to reinstall Flash to restore the source files back to the functional ones.

If you've added components, you'll need to refresh the Components panel.

To refresh the contents of the Components panel:

  • Select Reload from the Components panel menu.

To remove a component from the Components panel:

  • Remove the MXP or FLA file from the Configuration folder.

Benefits of using components

TOP

Components enable you to separate the process of designing your application from the process of coding. They also let you to reuse code, either in components that you create, or by downloading and installing components created by other developers.

Components allow coders to create functionality that designers can use in applications. Developers can encapsulate frequently used functionality into components and designers can customize the look and behavior of components by changing parameters in the Property inspector or the Component inspector.

Flash developers can use the Macromedia Exchange at www.macromedia.com/go/exchange to exchange components. By using components, you no longer need to build each element in a complex web application from scratch. You can find the components you need and put them together in a Flash document to create a new application.

Components that are based on the version 2 architecture share core functionality such as styles, event handling, skinning, focus management, and depth management. When you add the first version 2 component to an application, there is approximately 25K added to the document that provides this core functionality. When you add additional components, that same 25K is reused for them as well, resulting in a smaller increase in size to your document than you may expect. For information about upgrading components, see Upgrading version 1 components to version 2 architecture.

Component categories

TOP

Components included with Flash fall into the following five categories (the locations of their ActionScript source files roughly correspond to these categories as well and are listed in parentheses):

  • Data components (mx.data.*)

    Data components allow you to load and manipulate information from data sources; the WebServiceConnector and XMLConnector components are data components.

    NOTE The source files for the data components aren't installed with Flash. However, some of the supporting ActionScript files are installed.

  • FLVPlayback component (mx.video.FLVPlayback)

    The FLVPlayback component lets you readily include a video player in your Flash application to play progressive streaming video over HTTP, from a Flash Video Streaming Service (FVSS), or from Flash Communication Server (FCS).

  • Media components (mx.controls.*)

    Media components let you play back and control streaming media; MediaController, MediaPlayback, and MediaDisplay are media components.

  • User interface components (mx.controls.*)

    User interface components (often referred to as "UI Components") allow you to interact with an application; for example, the RadioButton, CheckBox, and TextInput components are user

    interface controls.

  • Managers (mx.managers.*)

    Managers are nonvisual components that allow you to manage a feature, such as focus or depth, in an application; the FocusManager, DepthManager, PopUpManager, StyleManager, and SystemManager components are manager components.

  • Screens (mx.screens.*)

    The screens category includes the ActionScript classes that allow you to control forms and slides in Flash.

For a complete list of components, see Components Language Reference.

About version 2 component architecture

TOP

You can use the Property inspector or the Component inspector to change component parameters to make use of the basic functionality of components. However, if you want greater control over components, you need to use their APIs and understand a little bit about the way they were built.

Flash components are built with version 2 of the Macromedia Component Architecture. Version 2 components are supported by Flash Player 6 (6.0.79.0) and later, and ActionScript 2.0. These components are not always compatible with components built using version 1 architecture (all components released before Flash MX 2004). Also, the original version 1 components are not supported by Flash Player 7. For more information, see Upgrading version 1 components to version 2 architecture.

NOTE Flash MX UI components have been updated to work with Flash Player 7 or later. These updated components are still based on version 1 architecture. You can download them from the Macromedia Flash Exchange at www.macromedia.com/go/v1_components.

Version 2 components are included in the Components panel as compiled clip (SWC) symbols. A compiled clip is a component movie clip whose code has been compiled. Compiled clips cannot be edited, but you can change their parameters in the Property inspector and Component inspector, just as you would with any component. For more information, see About compiled clips and SWC files.

Version 2 components are written in ActionScript 2.0. Each component is a class and each class is in an ActionScript package. For example, a radio button component is an instance of the RadioButton class whose package name is mx.controls. For more information about packages, see About packages in Learning ActionScript 2.0 in Flash.

Most UI components built with version 2 of the Macromedia Component Architecture are subclasses of the UIObject and UIComponent classes and inherit all properties, methods, and events from those classes. Many components are also subclasses of other components. The inheritance path of each component is indicated in its entry in the Components Language Reference.

NOTE The class hierarchy is also available as a FlashPaper file in the installation location: Flash 8\Samples and Tutorials\Samples\Components\arch_diagram.swf.

All components also use the same event model, CSS-based styles, and built-in themes and skinning mechanisms. For more information on styles and skinning, see Customizing Components.

For more information on event handling, see Working with Components.

For a detailed explanation of the version 2 component architecture, see Creating Components.

Version 2 component features

TOP

This section outlines the features of version 2 components (compared to version 1 components) from the perspective of a developer using components to build Flash applications. For detailed information about the differences between the version 1 and version 2 architectures for building components, see Creating Components.

The Component inspector allows you to change component parameters while authoring in Macromedia Flash and Macromedia Dreamweaver. (See Setting component parameters.)

The listener event model allows listeners to handle events. (See Handling Component Events.) Flash doesn't have a clickHandler parameter in the Property inspector, as there was in Flash MX; you must write ActionScript code to handle events.

Skin properties let you load individual skins (for example, up and down arrows or the check for a check box) at runtime. (See About skinning components.)

CSS-based styles allow you to create a consistent look and feel across applications. (See Using styles to customize component color and text.)

Themes allow you to drag a predesigned appearance from the library onto a set of components. (See About themes.)

The Halo theme is the default theme that the version 2 components use. (See About themes.)

Manager classes provide an easy way to handle focus and depth in a application. (See Creating custom focus navigation and Managing component depth in a document.)

The base classes UIObject and UIComponent provide core methods, properties, and events to components that extend them. (See UIComponent class and UIObject class in the Components Language Reference.)

Packaging as a SWC file allows easy distribution and concealable code. See Creating Components.

Built-in data binding is available through the Component inspector. For more information, see Data Integration (Flash Professional Only) in Using Flash. An easily extendable class hierarchy using ActionScript 2.0 allows you to create unique namespaces, import classes as needed, and subclass easily to extend components. See Creating

Components and the ActionScript 2.0 Language Reference.

NOTE Flash 8 has several features that are not supported by the v2 components, including 9-slice (sometimes referred to as "scale-9"), FlashType, and bitmap caching.

About compiled clips and SWC files

TOP

A compiled clip is a package of precompiled Flash symbols and ActionScript code. It's used to avoid recompiling symbols and code that will not be changed. A movie clip can also be "compiled" in Flash and converted to a compiled clip. For example, a movie clip with a lot of ActionScript code that doesn't change often could be converted to a compiled clip. The compiled clip behaves just like the movie clip from which it was compiled, but compiled clips appear and publish much faster than regular movie clips. Compiled clips can't be edited, but they do have properties that appear in the Property inspector and the Component inspector.

Components included with Flash are not FLA files--they are compiled clips (that have been packaged into compiled clip (SWC) files. SWC is the Macromedia file format for distributing components; it contains a compiled clip, the component's ActionScript class file, and other files that describe the component. For details about SWC files, see Exporting and distributing a component.

When you place a SWC file in the First Run/Components folder, the component appears in the Components panel. When you add a component to the Stage from the Components panel, a compiled clip symbol is added to the library.

To compile a movie clip:

  • Right-click (Windows) or Control-click (Macintosh) the movie clip in the Library panel, and then select Convert to Compiled Clip.

To export a SWC file:

  • Select the movie clip in the Library panel and right-click (Windows) or Control-click (Macintosh), and then select Export SWC File.

NOTE Flash Basic 8 and Flash Professional 8 continue to support FLA components.

Accessibility and components

TOP

A growing requirement for web content is that it should be accessible; that is, usable for people with a variety of disabilities. Visual content in Flash applications can be made accessible to the visually impaired with the use of screen reader software, which provides a spoken audio description of the contents of the screen.

When a component is created, the author can write ActionScript that enables communication between the component and a screen reader. When a developer uses that component to build an application in Flash, the developer uses the Accessibility panel to configure each component instance.

Most components built by Macromedia are designed for accessibility. To find out whether a component is accessible, see its entry in the Components Language Reference. When you're building an application in Flash, you'll need to add one line of code for each component (mx.accessibility.ComponentNameAccImpl.enableAccessibility();), and set the accessibility parameters in the Accessibility panel. Accessibility for components works the same way as it works for all Flash movie clips.

Most components built by Macromedia are also navigable by the keyboard. Each component's entry in the Components Language Reference indicates whether you can control the component with the keyboard.

Copyright ADOBE - All Rights Reserved Worldwide

 

 

More Topics:

Working with Flash Documents

How to work in Flash WorkSpace

Working with Projects in Flash

Process to Build your First Application in Flash

Using Symbols, Instances and Library Assets in Flash

How to Build Video Player in Flash

How to Work with Color, Strokes and Fills in Flash

How to Create Document in Flash

What is Vector and Bitmap Graphics in Flash

How to Create a Banner in Flash, Part 1

How to Work with Text in Flash

How to Create a Banner in Flash, Part 2

How to Use Imported Artwork in Flash

How to Create a Banner in Flash, Part 3

How to Work with Graphic Objects in Flash

How to Work with Layers in Flash

How to Use Filters and Blends

Working with Graphics in Flash

What is Accessibility Features in Flash

How to Create Motion (Shape Tween & Motion Tween) in Flash

How to Create an Application in Flash

What is Masking in Flash

How to Work with Video in Flash

How to Use Layout Tools in Flash

What are Behaviors in Flash

How to Work with Sound in Flash

How to Create Symbols and Instances in Flash

What is ActionScript in Flash

How to Write ActionScript With Script Assist in Flash

How to Add Button Animation and Navigation in Flash

What is Data Integration in Flash

How to Work with Screens

How to Create a Presentation with Screens

What is Extending Flash

How to Create Multilanguage Text in Flash

How to Create Graphics: Draw in Flash

What is Flash Lite

Ways of Data Integration

How to Create Graphics: Create a Timeline Animation in Flash

Getting Started with Flash Lite in Flash

How to Publish Flash Documents

How to Create Graphics: Making Animations with Easing

Learning Flash Lite 1.X ActionScript in Flash

How to Export Flash Content and Images from Flash

How to Create Graphics: Applying Gradients in Flash

Process of Writing and Editing ActionScript 2.0 in Flash

How to Create Accessible Content in Flash

How to Create Graphics: Apply Graphic Filters and Blends

What is Data and Data Types in Flash

Process of Printing from SWF Files in Flash

Using ActionScript: How to Use Script Assist mode in Flash

Learn Syntax and Language Fundamentals in Flash

How to Create E-learning Content in Flash

Using ActionScript: How to Write Scripts in Flash

Working with Functions and Methods in Flash

Process of Using Templates in Flash

Using ActionScript: Process of Adding Interactivity in Flash

What are Classes in Flash

Control Tag Summary of XML to UI in Flash

Using ActionScript: How to Create a Form with Conditional Logic and Send Data in Flash

What is Inheritance in Flash

What is Data Integration: Overview

Using ActionScript: How to Work with Objects and Classes in Flash

Overview on Interfaces in Flash

What is Data Integration: Using XML for a Timesheet

How to Work with Text and Strings in Flash

How to use Handling Events in Flash

What is Data Integration: Using XUpdate to Update the Timesheet

Learning Animation, Filters and Drawings in Flash

How to Work with Movie Clips in Flash

How to Create Interaction with ActionScript in Flash

How to Work with Images, Sound, and Video in Flash

How to Work with External Data in Flash

What is Security in Flash

How to Debug Applications in Flash

List of Error Messages in Flash

Using Object-Oriented Programming with ActionScript 1.0 in Flash

How to Write Scripts for Earlier Versions of Flash Player in Flash

List of all Keyboard Keys and Key Code Values for using in Flash

Terminology

Introduction to Components in Flash

What are Components in Flash

How to Create an Application with Components

How to Work with Components in Flash

How to Handle Component Events in Flash

How to Customize Components in Flash

How to Create Components in Flash

What is Collection Properties in Flash