如何确定 AS3 中的形状填充颜色?

How to determine shape fill color in AS3?

我在舞台上的 MovieClip 中有一个圆圈,实例名称为 holder。我想得到那个圆圈的颜色。

我成功定位了该圈子,如代码所示。我可以使用变换改变它的颜色,但我找不到实际检查它的颜色的方法。

holder.getChildAt(0);

好的,正如我在回复中所说,最后,这是我需要的。它可以稍微简化和优化,但是,就我的需求而言,它已经足够快了! :)

function decimalToHex(decimal: int, padding: int = 2): String {
    var hex: String = Number(decimal).toString(16);
    while (hex.length < padding) {
        hex = "0" + hex;
    }
    return hex.toUpperCase();
}

function getColor(what: Object):void {
    var obj = what.getChildAt(0);
    var bmd: BitmapData = new BitmapData(obj.width, obj.height, true, 0x00ffffff);
    //In the 0x00ffffff color, leading two zeros are alpha channel
    bmd.draw(obj);
    var img = new Bitmap(bmd);
    var stp = "";
    for (var l: uint = 0; l < img.height && stp == ""; l++) {
        for (var m: uint = 0; m < img.width && stp == ""; m++) {
            var color = decimalToHex(bmd.getPixel32(m, l), 8);
            if (int(parseInt(color.substr(0, 2), 16)) > 0) {
                color = "#" + color.substr(2);
                stp = "stop";
                // Display color in a text box named as "what"'s name + letter "c"
                param.getChildByName(what.name + "c").text = color;
            }
        }
    }
}

getColor(holder); //As in question, my shape is inside it's holder