Flash Training: Automatic Focus in a Flash Form

HomeTutorialsForumWebwasp MembersTemplatesMatesFoodContact

 


Flash Tutorials

   

Flash Tutorial - Automatic Focus in a Flash Form

 

Free Tutorial


Part 3    <<   Previous      Intro   1   2   3    >>       >>   Webwasp Mates

 

Part Three: Another Option: Nested Input Boxes

Example: Download the Flash file Int 135b

(The button below only works in Microsoft’s Internet Explorer!)

 

  1. Open a new Flash Movie: File > New
  2. Next select the Text tool:
  3. On the Stage drag out a: Text Box
  4. 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:


    Paragraph Text Box.

  5. Open the Property Inspector: Window> Properties (Ctrl F3)
  6. With the Text Box still highlighted select: Input Text


    Selecting Input Text from the Property Inspector.

  7. Select any Font, Style, Size and Colour:


    Selecting the Font Style.

  8. Select: Left Justify.
  9. 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

  10. In the Property Inspector give the Text Box the Instance Name:   inTxt_1
  11. In the Property Inspector give the Text Box the Var Name:   inTxt_1


    Properties for the Text Box.

  12. Create a new Text Box and call the Instance Name and Var Name: inTxt_2
  13. Create a new Text Box and call the Instance Name and Var Name: inTxt_3
  14. Create a new Text Box and call the Instance Name and Var Name: tf_4
  15. Note: This is named differently to the rest: tf_4

  16. Create a new Text Box and call the Instance Name and Var Name: Txt_5
  17. Create a new Text Box and call the Instance Name and Var Name: inTxt_6
  18. Create a new Text Box and call the Instance Name and Var Name: inTxt_7

  19. Now add Static Text next to each input field:
  20. Select the first three: Input Boxes
  21. Right click (Mac: Ctrl click) and select: Convert to Symbol
  22. For name type: mc1
  23. For behaviour select: Movie Clip




  24. In the Property Inspector give this new Movie Clip an Instance Name: mc1


    Giving the Symbol an Instance name.

  25. Now select the last three input box's and convert them to a: Movie Clip
  26. Give this new Symbol the Instance Name: mc2
  27. Note: You should have one input box in the middle that's not a movie clip (the forth one down).

  28. Add a new layer and call it: ActionScript
  29. Add this code to that layer in the first frame it:

    //set mc container properties to enable tabbing through child objects
    mc1.
    tabChildren = true;
    mc1.
    tabEnabled = false;
    mc2.
    tabChildren = true;
    mc2.
    tabEnabled = false;

    //set the tabbing sequence
    mc1.inTxt_1.
    tabIndex = 1;
    mc1.inTxt_2.tabIndex = 2;
    mc1.inTxt_3.tabIndex = 3;
    tf_4.tabIndex = 4;
    mc2.inTxt_5.tabIndex = 5;
    mc2.inTxt_6.tabIndex = 6;
    mc2.inTxt_7.tabIndex = 7;

    // set initial focus to the first input text object
    focusManager.
    setFocus(mc1.inTxt_1);
    // Clear the input box's
    _level0.mc1.inTxt_1 =
    "";
    _level0.mc1.inTxt_2 = "";
    _level0.mc1.inTxt_3 = "";
    _level0.tf_4 = "";
    _level0.mc2.inTxt_5 = "";
    _level0.mc2.inTxt_6 = "";
    _level0.mc2.inTxt_7 = "";
    stop();

  30. Now add the movie to your web page but use this HTML code:

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="XXX" height="XXX" id=myothermovie>
    <param name="movie" value="
    NameOfYourSWFMovie.swf">
    <param name="SeamlessTabbing" value="false">
    <param name="swLiveConnect" value="true">
    <param name="quality" value="high">
    <embed NAME=
    myothermovie src="NameOfYourSWFMovie.swf" SeamlessTabbing="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="XXX" height="XXX" swLiveConnect=true></embed>
    </object>


  31. Change the XXX to the values for the width and height that you require for your movie.
  32. Change the NameOfYourSWFMovie.swf to the name of your Movie's swf file
  33. In the HTML body tag change it from <BODY> to

    <body onLoad="window.document.myothermovie.focus();">

  34. Again this has the same Browser compatibility problems as the first movie but is just a good example of how to set up and use the focus manger in Flash

Please indicate what you thought of this tutorial 
10 is the best: 
10 9 8 7 6 5 4 3 2 1

         

Part 3    <<   Previous      Intro   1   2   3    >>       >>   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

35517 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.