Flash CS3 Documentation |
|||
| Using ActionScript 2.0 Components > Creating Components > Incorporating existing components within your component > Testing and exporting the LogIn 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 LogIn 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're completely finished creating 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 LogIn SWF. You are compiling the movie clip to test it, only. Otherwise, you would follow the instructions later in this section to export the LogIn movie clip.
|
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. |
You can set the name and password property in the Parameters tab or the Component Inspector. This is useful if you want default text such as "Enter your name here" to appear before the user has entered anything. When you set its name and/or password property, the default text in the name and password InputText sub-components will change accordingly at runtime.
To test the value property at runtime, name the LogIn instance on the Stage myLogin and add the following code to Frame 1 in the main Timeline:
// Creates a text field in which to view the login values.
createTextField("myLoginValues",10,10,10,340,40)
myLoginValues.border = true;
// Event handler for the login component instance's dispatched click event.
function click(evt){
/* Here is where authentication would occur.
For example the name and password would be passed to a web service which authenticates the name and password and returns a session ID and/or permission roles attributed to the user. */
myLoginValues.text = "Processing...\r";
myLoginValues.text += "Name: " + myLogin.name + " Password: " + myLogin.password;
}
myLogin.addEventListener("click",this);
|
NOTE |
|
Since you are testing this component within your original document, you may see a warning message about having the same linkage identifier for two symbols. The component will still work. In practice, you will use the new component within another document in which case the linkaged identifier should be unique. |
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 Components panel.
|
NOTE |
|
For information about folder locations, see "Configuration folders installed with Flash" in Using Flash. |
The completed LogIn 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/00002520.html