0

我想知道是否有办法使用 AS3 的 TextField 重新创建 Flash 的 Textarea 组件或接近它?

如果没有,那么是否有办法更改 AS3 TextField 的各个边框颜色,例如顶部、左侧、右侧和底部边框颜色。

4

1 回答 1

0

Flash Pro 的组件源代码可从您的安装处获得:

Mac:/Applications/Adobe Flash CS5.5/Common/Configuration/Component Source/ActionScript 3.0/User Interface

PC : C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface

没有蒙皮,aTextArea只是一个TextFieldwith:

textField.type = (enabled && _editable) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
textField.wordWrap = _wordWrap;
textField.multiline = true;

对焦后,添加浅蓝色发光滤镜。

来自 Flash Pro fl.controls.TextArea

// Copyright 2007. Adobe Systems Incorporated. All Rights Reserved.
/**
 * @private (protected)
 *
 * @langversion 3.0
 * @playerversion Flash 9.0.28.0
 */
override protected function configUI():void {
    super.configUI();
    tabChildren = true;

    textField = new TextField();
    addChild(textField);
    updateTextFieldType();

    _verticalScrollBar = new UIScrollBar();
    _verticalScrollBar.name = "V";
    _verticalScrollBar.visible = false;
    _verticalScrollBar.focusEnabled = false;
    copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
    _verticalScrollBar.addEventListener(ScrollEvent.SCROLL,handleScroll,false,0,true);
    addChild(_verticalScrollBar);

    _horizontalScrollBar = new UIScrollBar();
    _horizontalScrollBar.name = "H";
    _horizontalScrollBar.visible = false;
    _horizontalScrollBar.focusEnabled = false;
    _horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
    copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
    _horizontalScrollBar.addEventListener(ScrollEvent.SCROLL,handleScroll,false,0,true);
    addChild(_horizontalScrollBar);

    textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
    textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
    textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);

    _horizontalScrollBar.scrollTarget = textField;
    _verticalScrollBar.scrollTarget = textField;
    addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
于 2012-11-09T22:31:13.167 回答