Flash CS3 Documentation |
|||
| Using ActionScript 2.0 Components > Creating Components > Building your first component > Testing and exporting the Dial component | |||
You've created the Flash file that contains the graphical elements, the base classes and the class file that contains all the functionality of the Dial component. Now it's time to test the component.
Ideally, you would test the component as you work, especially while you're writing the class file. The fastest way to test as you work is to convert the component to a compiled clip and use it in the component's FLA file.
When you've completely finished a component, export it as a SWC file. For more information, see Exporting and distributing a component.
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. Select Replace Existing Items to add the new version to the document. |
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);
If you save it to the Components folder in the user-level configuration folder, you can reload the Components panel without restarting Flash and the component appears in the panel.
|
NOTE |
|
For information about folder locations, see "Configuration folders installed with Flash" in Using Flash. |
The completed Dial component
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00002487.html