⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fsbutton.java

📁 利用opensource的开源jar实现生成flash文件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    public boolean isActive() { return ((state & Active) != 0) ? true : false; }

    /** Does the Button Record define a shape for the button's 'down' state.

        @return a boolean flag indicating whether the button record defines the shape for the button's 'down' state.
        */
    public boolean isDown() { return ((state & Down) != 0) ? true : false; }

    /** Does the Button Record define a shape for the button's 'over' state.

        @return a boolean flag indicating whether the button record defines the shape for the button's 'over' state.
        */
    public boolean isOver() { return ((state & Over) != 0) ? true : false; }

    /** Does the Button Record define a shape for the button's 'up' state.

        @return a boolean flag indicating whether the button record defines the shape for the button's 'up' state.
        */
    public boolean isUp() { return ((state & Up) != 0) ? true : false; }

    /** Gets the identifier of the shape that this FSButton applies to. 

        @return the identifier of the shape.
        */
    public int getIdentifier() { return identifier; }

    /** Gets the layer that the button will be displayed on.

        @return the layer on which the shape is displayed.
        */
    public int getLayer() { return layer; }

    /** Gets the coordinate transform that will be applied to the button.

        @return the coordinate transform that is applied to the shape.
        */
    public FSCoordTransform getTransform() { return transform; }

    /** Gets the colour transform that will be applied to the button.

        @return the colour transform that is applied to the shape.
        */
    public FSColorTransform getColorTransform() { return colorTransform; }

    /** Set the state(s) of the button when the shape is drawn. The shape may be drawn for more than one state. Multiple states can be defined by bitwise-OR'ing individual states together, e.g.  Up | Over.

        @return the state of the button when the shape is drawn.
        */
    public void setState(int aNumber) { state = aNumber; }

    /** Sets the identifier of the  FSDefineShape, FSDefineShape2 or FSDefineShape3 object that defines the appearance of the button when it is in the specified state(s). 

        @param anIdentifier the identifier of the shape object that defines the shape's appearance.
        */
    public void setIdentifier(int anIdentifier)
    {
        identifier = anIdentifier;
    }

    /** Sets the layer in the display list that the shape will be displayed on.

        @param aNumber the number of the layer in the display list where the shape is drawn.
        */
    public void setLayer(int aNumber)
    {
        layer = aNumber;
    }

    /** Sets the coordinate transform that will be applied to the shape to change it's appearance.

        @param aTransform an FSCoordTransform object that will be applied to the shape.
        */
    public void setTransform(FSCoordTransform aTransform)
    {
        transform = aTransform;
    }

    /** Sets the colour transform that will be applied to the shape to change it's colour.

        @param aTransform an FSColorTransform object that will be applied to the shape.
        */
    public void setColorTransform(FSColorTransform aTransform)
    {
        colorTransform = aTransform;
    }

    public Object clone()
    {
        FSButton anObject = (FSButton)super.clone();
        
        anObject = (FSButton)super.clone();
        anObject.transform = (transform != null) ? (FSCoordTransform)transform.clone() : null;
        anObject.colorTransform = (colorTransform != null) ? (FSColorTransform)colorTransform.clone() : null;

        return anObject;
    }

    /** 
     * Returns true if anObject is equal to this one. Objects are considered 
     * equal if they would generate identical binary data when they are encoded 
     * to a Flash file.
     *
     * @return true if this object would be identical to anObject when encoded.
     */
    public boolean equals(Object anObject)
    {
        boolean result = false;
        
        if (super.equals(anObject))
        {
            FSButton typedObject = (FSButton)anObject;
            
            result = state == typedObject.state;
            result = result && identifier == typedObject.identifier;
            result = result && layer == typedObject.layer;

            if (transform != null)
                result = result && transform.equals(typedObject.transform);
            else
                result = result && transform == typedObject.transform;

            if (colorTransform != null)
                result = result && colorTransform.equals(typedObject.colorTransform);
            else
                result = result && colorTransform == typedObject.colorTransform;
        }
        return result;
    }

    public void appendDescription(StringBuffer buffer, int depth)
    {
        buffer.append(name());

        if (depth > 0)
        {
            buffer.append(": { ");
            Transform.append(buffer, "state", state);
            Transform.append(buffer, "identifier", identifier);
            Transform.append(buffer, "layer", layer);
            Transform.append(buffer, "transform", transform, depth);
            Transform.append(buffer, "colorTransform", colorTransform, depth);
            buffer.append("}");
        }
    }

    public int length(FSCoder coder)
    {
        int length = 0;
    
        length += 5;
        length += transform.length(coder);
// Flash 3
         if (coder.context[FSCoder.Type] == FSMovieObject.DefineButton2)
            length += colorTransform.length(coder);
// End Flash 3
        return length;
    }
    
    public void encode(FSCoder coder)
    {
        coder.writeBits(0, 4);
        coder.writeBits(state, 4);
        coder.writeWord(identifier, 2);
        coder.writeWord(layer, 2);
        transform.encode(coder);
// Flash 3
        if (coder.context[FSCoder.Type] == FSMovieObject.DefineButton2)
            colorTransform.encode(coder);
// End Flash 3
    }
    
    public void decode(FSCoder coder)
    {
        coder.readBits(4, false);
        
        state = coder.readBits(4, false);
        identifier = coder.readWord(2, false);
        layer = coder.readWord(2, false);

        transform = new FSCoordTransform(coder);
// Flash 3
        if (coder.context[FSCoder.Type] == FSMovieObject.DefineButton2)
            colorTransform = new FSColorTransform(coder);
// End Flash 3
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -