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.

To test the LogIn component:

  1. In the LogIn.fla file, select the LogIn movie clip in the library and select Convert to Compiled Clip from the Library context menu (Windows: Right-click, Mac: control-click).

    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.

  2. Drag LogIn SWF to the Stage in frame 1 of the main Timeline (make sure you're in the main Timeline, Scene 1, not the movie clip timeline).

    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);
    
    
  3. Select Control > Test Movie to test the component in Flash Player.

    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.

To export the LogIn component:

  1. In the LogIn.fla file, select the LogIn movie clip in the library and select Component Definition from the Library context menu (Windows: Right-click, Mac: control-click).
  2. Check the Display in Components panel.
  3. Click OK.
  4. In the LogIn.fla file, select the LogIn movie clip in the library, again, and select Export SWC File from the Library context menu (Windows: Right-click, Mac: control-click).
  5. Select a location to save the SWC file.

    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

    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