Failed to set textinput focus on the flex learning notes page Initialization

Source: Internet
Author: User

 

When initializing the creationcomplete event on the flex page, add the focus setting statement: focusmanager. setfocus ("textinput component ID ");

After the page is run, the results are not displayed. Place the focus setting statement in the button event, and textinput is the focus setting.

 

The main reason is that we embed flash into the HTML page. When opening the HTML page, it is not focused. Therefore, it is best to add a Javascript script on the HTML page to focus on it.

 

Steps:

1. In the page initialization creationcomplete event, add the focus setting statement: focusmanager. setfocus ("textinput component ID ");

2. Find this page in the bin-DEBUG directory. For example, login.html (the swf id of login is login). Add the js method to the body.

<Body onload = "document. getelementbyid ('swf ID to attach '). Focus ()">

 

You can use these two steps to initialize the focus.

 

 

Similarly, we can also use externalinterface. Call to call and write Js in the As script of flex,CodeAs follows:

Protected function Init (): void {
Focusmanager. setfocus (txtloginname); // txtloginname is the ID of the textinput component.
Externalinterface. Call ("document. getelementbyid ('login'). Focus ()"); // login is the swf id to be loaded.
}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.