Тема: setFocus?
Показать сообщение отдельно
Старый 18.05.2006, 15:09
MyXus вне форума Посмотреть профиль Отправить личное сообщение для MyXus Посетить домашнюю страницу MyXus Найти все сообщения от MyXus
  № 2  
Ответить с цитированием
MyXus
 
Аватар для MyXus

Регистрация: Mar 2001
Адрес: msk
Сообщений: 1,416
в хелпе есть код
Код:
this.createTextField("status_txt", this.getNextHighestDepth(), 100, 70, 100, 22);
this.createTextField("username_txt", this.getNextHighestDepth(), 100, 100, 100, 22);
this.createTextField("password_txt", this.getNextHighestDepth(), 100, 130, 100, 22);
this.createEmptyMovieClip("submit_mc", this.getNextHighestDepth());
submit_mc.createTextField("submit_txt", this.getNextHighestDepth(), 100, 160, 100, 22);
submit_mc.submit_txt.autoSize = "center";
submit_mc.submit_txt.text = "Submit";
submit_mc.submit_txt.border = true;
submit_mc.onRelease = checkForm;
username_txt.border = true;
password_txt.border = true;
username_txt.type = "input";
password_txt.type = "input";
password_txt.password = true;
Selection.setFocus("username_txt");
//
function checkForm():Boolean {
    if (username_txt.text.length == 0) {
    status_txt.text = "fill in username";
    Selection.setFocus("username_txt");
    return false;
    }
    if (password_txt.text.length == 0) {
    status_txt.text = "fill in password";
    Selection.setFocus("password_txt");
    return false;
    }
    status_txt.text = "success!";
    Selection.setFocus(null);
    return true;
}
однако он у меня почему то не работает.
Однако, если бы он работал, в нём можно было бы найти необходимое решение: Selection.setFocus(null);