|
|
|||||
FOCUS_IN для текста
Привет, уважаемые =)
Скажите, в чем синтаксическая ошибка, не могу понять: package textAction{ import flash.display.*; import flash.events.*; import flash.text.*; public class HighlightText extends Sprite{ public function HighlightText():void { var s:Sprite = new Sprite(); s.x = 100; s.y = 100; var t:TextField = new TextField(); t.text = "Click here"; t.background = true; t.border = true; t.autoSize = TextFieldAutoSize.LEFT(); s.addChild(t); addChild(s); s.addEventListener(FocusEvent.FOCUS_IN, + e.target); } public function focusInListener(e.FocusEvent):void { trace("Target of this event dispatch: " + e.target); TextField(e.target).backgroundColor = 0xFF0000; } } } |
|
|||||
Регистрация: Oct 2009
Адрес: г. Казань
Сообщений: 82
|
public function focusInListener(e:FocusEvent):void {
trace("Target of this event dispatch: " + e.target); TextField(e.target).backgroundColor = 0xFF0000; }
__________________
AS3Coding: ActionScript 3.0, FlashDevelop, ... |
|
|||||
Регистрация: Aug 2008
Адрес: Рязань
Сообщений: 723
|
а этот класс лежит в textAction?
__________________
low + |
|
|||||
папка "textAction" в ней fla файл, в нем этот скрипт
|
|
|||||
Цитата:
__________________
2+2=5 |
|
|||||
может в поле "Document class" еужно что - то указывать?)
Добавлено через 4 минуты Цитата:
Добавлено через 6 минут package textAction{ import flash.display.*; import flash.events.*; import flash.text.*; public class HighlightText extends Sprite{ public function HighlightText():void { var s:Sprite = new Sprite(); s.x = 100; s.y = 100; var t:TextField = new TextField(); t.text = "Click here"; t.background = true; t.border = true; t.autoSize = TextFieldAutoSize.LEFT(); s.addChild(t); addChild(s); s.addEventListener(FocusEvent.FOCUS_IN, focusInListener); } public function focusInListener(e:FocusEvent):void { trace("Target of this event dispatch: " + e.target); TextField(e.target).backgroundColor = 0xFF0000; } } } ругается так: "Packages cannot be nested" |
|
|||||
Регистрация: Apr 2009
Сообщений: 117
|
"package textAction{" нужно заменить на "package {"
|
|
|||||
t.addEventListener(FocusEvent.FOCUS_IN, focusInListener);
__________________
http://cleptoman.free-lance.ru achivements: дважды благословлен на воровство. осеяный благодатью |
Часовой пояс GMT +4, время: 16:16. |
|
« Предыдущая тема | Следующая тема » |
Теги |
error , FOCUS_IN , textfield |
|
|