User Guide

Building your first component 923
To test the Dial component:
1.
In the Dial.fla file, choose the Dial component in the library and choose Convert to Compiled
Clip from the Library options menu.
A compiled clip is added to the library with the name Dial SWF.
Note: If you’ve already created a compiled clip (for example, if this is the second or third time
you’re testing), a Resolve Library Conflict dialog box appears. Choose Replace Existing Items to
add the new version to the document.
2.
Drag Dial SWF to the Stage on the main Timeline.
3.
You can resize it and set its value property in the Property inspector or the Component
Inspector. When you set its value property, the needle’s position should change accordingly.
4.
To test the value property at runtime, give the dial the instance name dial and add the
following code to Frame 1 on the main Timeline:
// position of the text field
var textXPos:Number = dial.width/2 + dial.x
var textYPos:Number = dial.height/2 + dial.y;
// creates a text field in which to view the dial.value
createTextField("dialValue", 10, textXPos, textYPos, 100, 20);
// creates a listener to handle the change event
function change(evt){
// places the value property in the text field
// whenever the needle moves
dialValue.text = dial.value;
}
dial.addEventListener("change", this);
5.
Choose Control > Test Movie to test the component in Flash Player.