如何使用其他类的私有静态方法

时间:2012-03-17 21:35:42

标签: actionscript-3 inheritance static-methods superclass private-methods

我正在编写扩展adobe air PNGEncoder的课程,

我想使用writeChunk方法,但它似乎是私有静态的,我似乎无法使用它与我的代码 但它给出了如下错误

  

错误:   描述资源路径位置类型   1061:通过带有静态类型com.adobe.images:PNGEncoder的引用调用可能未定义的方法writeChunk。 pngMethods.as / FOTO_WITH_AS3_1 / src / xmp第121行Flex问题

我的班级

public class pngMethods extends PNGEncoder
{

    public function pngMethods()
    {
        super();            
    }
    public function myMethod(pngOutput:ByteArray,IHDRByteArray:ByteArray):void
    {
        super.writeChunk(pngOutput,0x49484452,IHDRByteArray);
    }
}

Adob​​e PNG METHOD

    private static var crcTable:Array;
    private static var crcTableComputed:Boolean = false;

    private static function writeChunk(png:ByteArray, 
            type:uint, data:ByteArray):void {
        if (!crcTableComputed) {
            crcTableComputed = true;
            crcTable = [];
            var c:uint;
            for (var n:uint = 0; n < 256; n++) {
                c = n;
                for (var k:uint = 0; k < 8; k++) {
                    if (c & 1) {
                        c = uint(uint(0xedb88320) ^ 
                            uint(c >>> 1));
                    } else {
                        c = uint(c >>> 1);
                    }
                }
                crcTable[n] = c;
            }
        }
        var len:uint = 0;
        if (data != null) {
            len = data.length;
        }
        png.writeUnsignedInt(len);
        var p:uint = png.position;
        png.writeUnsignedInt(type);
        if ( data != null ) {
            png.writeBytes(data);
        }
        var e:uint = png.position;
        png.position = p;
        c = 0xffffffff;
        for (var i:int = 0; i < (e-p); i++) {
            c = uint(crcTable[
                (c ^ png.readUnsignedByte()) & 
                uint(0xff)] ^ uint(c >>> 8));
        }
        c = uint(c^uint(0xffffffff));
        png.position = e;
        png.writeUnsignedInt(c);

1 个答案:

答案 0 :(得分:1)

私人方法对外界是不可见的 - 即使继承也不行。