gpt4 book ai didi

validation - 失败验证时设置Spark TextInput背景

转载 作者:行者123 更新时间:2023-12-03 07:55:19 29 4
gpt4 key购买 nike

如何在错误状态下指定TextInput的外观?关于该主题的文档似乎很稀缺!

没有错误状态,但是有一个errorSkin可以指定(它必须是ErrorSkin的子类吗?)。

我想设置TextInput的背景色,并在验证失败时增加边框的粗细。我该怎么做呢?

最佳答案

我最终得到的是:

public class ObviousErrorSkin extends ErrorSkin
{
private static var glowFilter:GlowFilter = new GlowFilter(0xFF0000, 0.85, 8, 8, 3, 1, true, true);

private static var rect:Rectangle = new Rectangle();

private static var filterPt:Point = new Point();

override protected function processBitmap():void
{
rect.x = rect.y = 0;
rect.width = bitmap.bitmapData.width;
rect.height = bitmap.bitmapData.height;
glowFilter.color = target.getStyle("errorColor");
bitmap.bitmapData.applyFilter(bitmap.bitmapData, rect, filterPt, glowFilter);
}

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
// Early exit if we don't have a target object
if (!target)
return;

super.updateDisplayList(unscaledWidth, unscaledHeight);

graphics.clear();
graphics.beginFill(target.getStyle("errorColor"), 0.25);
graphics.drawRect(bitmap.x, bitmap.y, bitmap.width, bitmap.height);
graphics.endFill();
}
}

关于validation - 失败验证时设置Spark TextInput背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10323982/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com