// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:06:24
// 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/ReplaceSymbolCommand

package com.macromedia.generator.commands;

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

public class ReplaceSymbolCommand extends GenericCommand
{

    public ReplaceSymbolCommand()
    {
    }

    public void doCommand(FlashEnvironment flashenvironment, Script script, Context context, int i, Properties properties)
        throws FlashCommandException
    {
        _fld0109 = new GenVector(16);
        Script script1 = (Script)_fld0109.add(script.getCommandScript(i));
        String s = properties.getProperty("name", "");
        String s1 = properties.getProperty("replace", "true");
        s = context.apply(s);
        s1 = context.apply(s1);
        if(s1.equalsIgnoreCase("true"))
        {
            if(s == null)
            {
                logError(flashenvironment, "MissingSymbolName", null);
                return;
            }
            Script script2 = (Script)_fld0109.add(script.findScript(s));
            if(script2 == null)
                script2 = (Script)_fld0109.add(flashenvironment.getTemplate().findScript(s));
            if(script2 != null)
                try
                {
                    Script script4 = (Script)_fld0109.add(script2.copyScript());
                    flashenvironment.processScript(script4, context);
                    script.setCommandScript(i, script4);
                }
                catch(GeneratorApiException _ex)
                {
                    logError(flashenvironment, "UnableToReplaceSymbol", s);
                }
            else
                logError(flashenvironment, "UnableToFindSymbol", s);
        } else
        {
            Script script3 = (Script)_fld0109.add(script.getCommandScript(i));
            flashenvironment.processScript(script3, context);
        }
        _fld0109.release();
    }

    GenVector _fld0109;
}