【问题标题】:How do I set the color of a NumericStepper?如何设置 NumericStepper 的颜色?
【发布时间】:2014-10-07 01:04:52
【问题描述】:

这个问题我已经看过了:How to change the text color in NumericStepper引用的链接坏了。

我有以下代码:

var sdAdopt:NumericStepper = sdAdoptGroup.getChildAt(year) as NumericStepper;
sdAdopt.textDisplay.setStyle("color","red");

它不起作用。

我也试过

sdAdopt.setStyle("color", 0xFF0000);

我也尝试过使用 textFormatter 对象。没有任何效果。怎么回事?

【问题讨论】:

标签: apache-flex flex-spark numericstepper


【解决方案1】:

要更改文本的颜色,只需像这样使用 setStyle。

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:layout>
        <s:VerticalLayout />
    </s:layout>

    <fx:Script>
        <![CDATA[
            protected function click(event:MouseEvent):void
            {
                ns.textDisplay.setStyle("color", 0xFF0000);
            }
        ]]>
    </fx:Script>


    <s:NumericStepper id="ns"/>
    <s:Button click="click(event)" label="Change Color" />
</s:Application>

我不确定为什么您的示例代码在调用 getChildAt 时使用 year。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-28
    • 2013-01-10
    • 2011-12-13
    • 2013-09-19
    • 1970-01-01
    • 2012-03-21
    • 2018-07-22
    相关资源
    最近更新 更多