// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:06:30
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   com/macromedia/generator/commands/SetCustomColorCommand

package com.macromedia.generator.commands;

import com.macromedia.generator.api.*;
import com.macromedia.generator.app.*;
import java.util.Properties;

public class SetCustomColorCommand extends GenericCommand
{

    public SetCustomColorCommand()
    {
    }

    public void doCommand(FlashEnvironment flashenvironment, Script script, Context context, int i, Properties properties)
        throws FlashCommandException
    {
        float f = 100F;
        float f1 = 100F;
        float f2 = 100F;
        float f3 = 100F;
        int j = 0;
        int k = 0;
        int l = 0;
        int i1 = 0;
        _fld0109 = new GenVector(16);
        Script script1 = (Script)_fld0109.add(script.getCommandScript(i));
        flashenvironment.processScript(script1, context);
        try
        {
            f = Float.valueOf(context.apply(properties.getProperty("percentred", ""))).floatValue();
            if((double)f < -100D || (double)f > 100D)
            {
                f = 100F;
                logError(flashenvironment, "InvalPercentRed", null);
            }
        }
        catch(NumberFormatException _ex)
        {
            f = 100F;
            logError(flashenvironment, "InvalPercentRed", null);
        }
        try
        {
            f1 = Float.valueOf(context.apply(properties.getProperty("percentgreen", ""))).floatValue();
            if((double)f1 < -100D || (double)f1 > 100D)
            {
                f1 = 100F;
                logError(flashenvironment, "InvalPercentGreen", null);
            }
        }
        catch(NumberFormatException _ex)
        {
            f1 = 100F;
            logError(flashenvironment, "InvalPercentGreen", null);
        }
        try
        {
            f2 = Float.valueOf(context.apply(properties.getProperty("percentblue", ""))).floatValue();
            if((double)f2 < -100D || (double)f2 > 100D)
            {
                f2 = 100F;
                logError(flashenvironment, "InvalPercentBlue", null);
            }
        }
        catch(NumberFormatException _ex)
        {
            f2 = 100F;
            logError(flashenvironment, "InvalPercentBlue", null);
        }
        try
        {
            f3 = Float.valueOf(context.apply(properties.getProperty("percentalpha", ""))).floatValue();
            if((double)f3 < -100D || (double)f3 > 100D)
            {
                f3 = 100F;
                logError(flashenvironment, "InvalPercentAlpha", null);
            }
        }
        catch(NumberFormatException _ex)
        {
            f3 = 100F;
            logError(flashenvironment, "InvalPercentAlpha", null);
        }
        try
        {
            j = (int)Float.valueOf(context.apply(properties.getProperty("offsetred", ""))).floatValue();
            if(j < -255 || j > 255)
            {
                logError(flashenvironment, "InvalRedOffset", null);
                j = 0;
            }
        }
        catch(NumberFormatException _ex)
        {
            j = 0;
            logError(flashenvironment, "InvalRedOffset", null);
        }
        try
        {
            k = (int)Float.valueOf(context.apply(properties.getProperty("offsetgreen", ""))).floatValue();
            if(k < -255 || k > 255)
            {
                logError(flashenvironment, "InvalGreenOffset", null);
                k = 0;
            }
        }
        catch(NumberFormatException _ex)
        {
            k = 0;
            logError(flashenvironment, "InvalGreenOffset", null);
        }
        try
        {
            l = (int)Float.valueOf(context.apply(properties.getProperty("offsetblue", ""))).floatValue();
            if(l < -255 || l > 255)
            {
                logError(flashenvironment, "InvalBlueOffset", null);
                l = 0;
            }
        }
        catch(NumberFormatException _ex)
        {
            l = 0;
            logError(flashenvironment, "InvalBlueOffset", null);
        }
        try
        {
            i1 = (int)Float.valueOf(context.apply(properties.getProperty("offsetalpha", ""))).floatValue();
            if(i1 < -255 || i1 > 255)
            {
                logError(flashenvironment, "InvalAlphaOffset", null);
                i1 = 0;
            }
        }
        catch(NumberFormatException _ex)
        {
            i1 = 0;
            logError(flashenvironment, "InvalAlphaOffset", null);
        }
        try
        {
            script.setCommandColor(i, f, j, f1, k, f2, l, f3, i1);
        }
        catch(GeneratorApiRuntimeException _ex)
        {
            logError(flashenvironment, "ErrorSettingColor", null);
            return;
        }
        _fld0109.release();
    }

    GenVector _fld0109;
}