Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set focus to a textbox 1

Status
Not open for further replies.

VBRookie

Programmer
May 29, 2001
331
US
Howdy,

I have a login form that I created in flash and I want the focus to be set to the loginID textbox when the movie loads. Does anyone know how to do that?

- VB Rookie
 
From the AS dictionary...


Selection.setFocus

Availability

Flash Player 5. Instance names for button and text fields only work in Flash Player 6.

Usage

Selection.setFocus(" variablePath" )

Parameters
variablePath A string specifying the path to the name of a variable associated with a text field.

Returns
An event.

Description
Method; focuses the editable text field associated with the variable specified by the variablePath. The variablePath parameter must be a string literal of the path to that variable. You can use dot or slash notation to specify the path. You can also use a relative or absolute path.

If a target path of a button instance is passed as the variablePath parameter, that button becomes the new focus. If a target path of a text field instance is passed as the variablePath parameter, that text field becomes the new focus. If null is passed, the current focus is removed.

If a button movie clip is passed to Selection.setFocus , it becomes the currently focused button. If a TextField object is specified, it becomes the current focus. If a Button object is specified, it becomes the currently focused button.

Example
The following example sets focus on a text field on the main Timeline that is associated with the myVar variable. The variablePath parameter is an absolute path, so you can call the action from any Timeline.


Selection.setFocus("_root.myVar");
In the following example, the text field associated with myVar is in a movie clip called myClip on the main Timeline. You can use either of the following two paths to set focus; the first is relative and the second is absolute.


Selection.setFocus("myClip.myVar");
Selection.setFocus("_root.myClip.myVar");
Regards,

new.gif
 
Many thanks oldNewbie.
I will test this out.
Thank you much.

- Vb Rookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top