![]() |
|
||||||||||
|
|||||
|
Регистрация: Jan 2007
Сообщений: 302
|
Здравств.
Хочу, чтоб при загрузке у меня автоматически курсор падал в поле TextField. Не падает почему - то.. На форуме вычитал stage.focus = myTextField; Вот кусочек кода. package { import flash.display.Sprite; import MainScreen; import Buttons; import flash.events.TimerEvent; import flash.utils.Timer; import flash.events.Event; import flash.events.MouseEvent; import flash.display.Stage; import flash.display.StageScaleMode; import flash.display.StageAlign; import flash.text.TextField; import flash.text.TextFieldType; public class Main extends Sprite { var imp_MainScreen:MainScreen; var fon:mcFon; var tf_spName:TextField; var scrTimer:Timer; var add_Btn:Buttons; var c:Sprite; //----------------------------------------------------------- public function Main() { if(stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(event:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, init); stage.showDefaultContextMenu = false; spName(); stage.focus = tf_spName; } //----------------------------------------------------------- private function spName():void{ add_Btn = new Buttons(); c = new Sprite(); c = add_Btn.Btn(110,30,"Create Spieler",0x288e20,1.0); c.x = 400; c.y = 245; c.buttonMode = true; c.mouseChildren = false; c.addChild(add_Btn); stage.addChild(c); tf_spName = new TextField(); tf_spName.x = 375; tf_spName.y = 220; tf_spName.width = 150; tf_spName.height = 20; tf_spName.border=true; tf_spName.borderColor = 0xFFFFFF; tf_spName.type=TextFieldType.INPUT; tf_spName.textColor = 0xFFFFFF; stage.addChild(tf_spName); c.addEventListener(MouseEvent.ROLL_OVER, over); c.addEventListener(MouseEvent.ROLL_OUT, out); c.addEventListener(MouseEvent.CLICK, timer); } //----------------------------------------------------------- |
|
|||||
|
Регистрация: Sep 2008
Сообщений: 27
|
таже проблема, все решения которые нашёл в интернете не работают.. что делать?
|
|
|||||
|
Регистрация: Nov 2009
Адрес: в златоглавой
Сообщений: 745
|
Не понимаю. У меня it works like clockwork!
package { import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFieldType; public class Main extends Sprite { private var _textField:TextField; public function Main() { _textField = new TextField(); _textField.x = _textField.y = 150; _textField.type = TextFieldType.INPUT; _textField.border = true; addChild(_textField); stage.focus = _textField; } } }
__________________
Нормально делай — нормально будет! |
![]() |
![]() |
Часовой пояс GMT +4, время: 20:35. |
|
|
« Предыдущая тема | Следующая тема » |
|
|