1 50 51 package org.openlaszlo.iv.flash.commands; 52 53 import org.openlaszlo.iv.flash.parser.*; 54 import org.openlaszlo.iv.flash.api.*; 55 import org.openlaszlo.iv.flash.util.*; 56 57 import org.openlaszlo.iv.flash.context.Context; 58 import java.util.Locale ; 59 60 public class MovieSetCommand extends GenericCommand { 61 62 public MovieSetCommand() {} 63 64 public void doCommand( FlashFile file, Context context, Script parent, int frame ) throws IVException { 65 String rate = getParameter( context, "rate" ); 66 String width = getParameter( context, "width" ); 67 String height = getParameter( context, "height" ); 68 String color = getParameter( context, "color" ); 69 String encoding = getParameter( context, "encoding", "default" ); 70 71 if( rate != null ) { 73 double f; 74 if( isDefault(rate) ) { 75 f = 12.0; 76 } else { 77 f = Util.toDouble(rate, -1); 78 if( f <= 0.0 || f > 120.0 ) { 79 Log.logRB(Resource.INVALRATEVALUE, new Object [] {rate}); 80 f = 12.0; 81 } 82 } 83 file.setFrameRate( ((int)f) << 8 ); 84 } 85 86 double mywidth = file.getFrameSize().getWidth(); 88 double myheight = file.getFrameSize().getHeight(); 89 90 if( width != null ) { 91 if( isDefault(width) ) { 92 mywidth = 550*20; 93 } else { 94 mywidth = Util.toInt(width, 550)*20; 95 } 96 } 97 98 if( height != null ) { 100 if( isDefault(height) ) { 101 myheight = 400*20; 102 } else { 103 myheight = Util.toInt(height, 400)*20; 104 } 105 } 106 107 file.getFrameSize().setFrame( 0, 0, mywidth, myheight ); 108 109 if( color != null ) { 111 Color c; 112 if( isDefault(color) ) { 113 c = AlphaColor.white; 114 } else { 115 c = Util.toColor( color, AlphaColor.white ); 116 } 117 parent.setBackgroundColor( new SetBackgroundColor(c) ); 118 } 119 120 if( isDefault(encoding) ) { 121 String lang = Locale.getDefault().getLanguage(); 122 if( lang.equals(Locale.JAPANESE.getLanguage()) ) { 123 file.setEncoding("SJIS"); 124 } else if( lang.equals(Locale.KOREAN.getLanguage()) ) { 125 file.setEncoding("EUC_KR"); 126 } 127 } else { 128 file.setEncoding(encoding); 129 } 130 131 } 132 133 public boolean isGlobal() { 134 return true; 135 } 136 } 137 | Popular Tags |