![]() |
|
||||||||||
|
|||||
|
Регистрация: Aug 2009
Сообщений: 24
|
Респект флеш мастерам
Вот, есть код(AS2) добавления в скобки выделенного текста из TextField, помогите переписать под ActionScript 3.0 txt - name TextField tr - button txt.onSetFocus = txt_onSetFocusHandler; txt.onKillFocus = txt_onKillFocusHandler; tr.onRelease = tr_onReleaseHandler; var beginIndex:Number; var endIndex:Number; function txt_onSetFocusHandler(oldFocus:Object):Void { onMouseUp = onMouseUpHandler; } function txt_onKillFocusHandler(newFocus:Object):Void { delete onMouseUp; } function onMouseUpHandler():Void { beginIndex = Selection.getBeginIndex(); endIndex = Selection.getEndIndex(); } function tr_onReleaseHandler():Void { if (beginIndex == endIndex) return; var newString:String = '(' + txt.text.substring(beginIndex, endIndex) + ')'; txt.replaceText(beginIndex, endIndex, newString); delete beginIndex; delete endIndex; } |
|
|||||
|
...
модератор форума
Регистрация: Sep 2006
Адрес: Minsk
Сообщений: 4,286
|
Узнаю своё дитя =) http://flasher.ru/forum/showthread.php?p=839737
tr.addEventListener(MouseEvent.CLICK, tr_clickHandler); function tr_clickHandler(event:MouseEvent):void { var beginIndex:int = txt.selectionBeginIndex; var endIndex:int = txt.selectionEndIndex; if (beginIndex == endIndex) return; var newString:String = "[" + txt.text.substring(beginIndex, endIndex) + "]"; txt.replaceText(beginIndex, endIndex, newString); } Последний раз редактировалось udaaff; 01.09.2009 в 01:43. |
![]() |
![]() |
Часовой пояс GMT +4, время: 23:40. |
|
|
« Предыдущая тема | Следующая тема » |
|
|