User Guide
130 Creating Components
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.
Creating the Dial class file
Now, you need to create the Dial class file as a new ActionScript file.
To create the Dial class file:
1. In Flash, select File > New and then select ActionScript File.
2. Select File > Save As and save the file as Dial.as in the same folder as the Dial.fla file.
3. You can copy or type the following Dial component ActionScript class code into your new
Dial.as file. Typing rather than copying the code helps you become familiar with each
element of the component code.
Please read the comments in the code for a description of each section. (For detailed
information on the elements of a component class file, see “Overview of a component
class file” on page 144.
// Import the package so you can reference
// the class directly.
import mx.core.UIComponent;
// Event metadata tag
[Event("change")]
class Dial extends UIComponent
{
// Components must declare these to be proper
// components in the components framework.
static var symbolName:String = "Dial";
static var symbolOwner:Object = Dial;
var className:String = "Dial";
// The needle and dial movie clips that are
// the component's graphical representation
private var needle:MovieClip;
private var dial:MovieClip;
private var boundingBox_mc:MovieClip;
NOTE
You can use any text editor to save the Dial.as file.