Flash Tutorial: Automatic Focus in a Flash Form

HomeTutorialsForumWebwasp MembersTemplatesMatesFoodContact

 


Flash Tutorials

   

Flash Tutorial - Automatic Focus in a Flash Form

 

Free Tutorial


Step 1    <<   Previous      Intro   1   2   3     Next   >>       >>   Webwasp Mates

 

Step One: Create the Input Box

  1. Open a new Flash Movie.
  2. Select the Text tool and drag a text box on stage.
  3. Note: If you have dragged the text tool you should get a paragraph text box which has a square in the top right hand corner:


  4. Open the Property Inspector: Window > Properties (Ctrl F3)
  5. With your Text Box still highlighted select: Input Text (from the drop down menu):


  6. Select the font, font style, size and colour.
  7. Select: Left Justify.
  8. If your Property Inspector is in collapsed view, click on the down arrow in the bottom right corner of the Property Inspector to expand the panel. If you have an up arrow your panel is already expanded: Expand Property Inspector
  9. In the Property Inspector give your Text Box the Instance Name:   /:Text1
  10. In the Property Inspector give your Text Box the Var Name:   /:Text1


    Text Box Properties.


  11. Create a new: Text Box
  12. Note: The easiest way is to copy and paste the existing Text box.

  13. Give this new Text Box the Instance Name and Var Name:   /:Text2
  14. Create a third Text box with the Instance Name and Var Name:   /:Text3


    My Three Input Boxes.


  15. Add 3 static lines of text next to each of the above Text Boxes: Input 1:   Input 2:   Input 3:


    My Three input Text Boxes now have labels: Input 1 to 3.

  16. Place a button Off Stage: Button
  17. Note: This button is there so that we can attach some ActionScript to it. It is not designed to be seen (or clicked!!). For this reason you can use any standard button that you may find in the Button Library: Window > Other Panels > Common Libraries > Buttons

    Do not use Knobs, Faders or Component buttons as they have different ActionScript.

  18. Add this code to your button:
  19. on (keyPress "<Tab>"){
        
    if (_root.a == 0) {
            
    Selection.setFocus("_root.Text1");
            
    Selection.setSelection(length(/:Text1), length(/:Text1));
            
    _root.a = 1;
        }
    else if (_root.a == 1) {
            
    Selection.setFocus("_root.Text2");
            
    Selection.setSelection(length(/:Text2), length(/:Text2));
            
    _root.a = 2;
        }
    else if (_root.a == 2) {
            
    Selection.setFocus("_root.Text3");
            
    Selection.setSelection(length(/:Text3), length(/:Text3));
            
    _root.a = 0;
        }
    }

  20. Add a new layer and call it ActionScript
  21. Add this code to the first frame of the ActionScript:
  22. var a = 0;

         

Step 1    <<   Previous      Intro   1   2   3     Next   >>       >>   Webwasp Mates


Webwasp Community: Webwasp Mates & Dates

Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates

37104 visitors to this page since Sept 05 •

Phil Schulz's Facebook profile
Webwasp is Phil Schulz's baby. You are welcome to contact me or become my Facebook friend: Click here

 Top of Page Home Food Mates Members Tutorials Forum Buy Templates Contact Us 
 All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.