1 50 51 package org.openlaszlo.iv.flash.commands; 52 53 import java.awt.geom.*; 54 import org.openlaszlo.iv.flash.parser.*; 55 import org.openlaszlo.iv.flash.api.*; 56 import org.openlaszlo.iv.flash.util.*; 57 58 import org.openlaszlo.iv.flash.context.Context; 59 60 public class InsertMovieClipCommand extends GenericCommand { 61 62 public InsertMovieClipCommand() {} 63 64 public void doCommand( FlashFile file, Context context, Script parent, int frame ) throws IVException { 65 boolean scale = getBoolParameter( context, "scale", false ); 66 String name = getParameter( context, "name", "" ); 67 String instancename = getParameter( context, "instancename" ); 68 69 Script script = file.getScript(name); 70 if( script == null ) { 71 throw new IVException( Resource.CMDSCRIPTNOTFOUND, new Object [] {name, getCommandName()} ); 72 } 73 script = script.copyScript(); 74 file.processScript(script, context); 75 76 Instance inst = getInstance(); 77 inst.setScript( script ); 78 if( scale ) { 79 Rectangle2D bounds = script.getBounds(); 80 double width = bounds.getWidth(); 81 double height = bounds.getHeight(); 82 inst.matrix.scale( 2048.0/width, 2048.0/height ); 83 } 85 86 if( instancename != null ) { 87 inst.name = instancename; 88 } 89 } 90 91 } 92 | Popular Tags |