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 59 public class SetAlphaCommand extends GenericCommand { 60 61 public SetAlphaCommand() {} 62 63 public void doCommand( FlashFile file, Context context, Script parent, int frameNum ) throws IVException { 64 Instance inst = getCommandInstance(file, context, parent, frameNum); 65 66 processFlashDef(inst, file, context); 68 69 String percent = getParameter( context, "percent" ); 70 int f = 256; 71 72 if( percent != null ) { 73 try { 74 f = (int) (Double.valueOf(percent).doubleValue()*256/100.0); 75 if( f < 0 || f > 256 ) { 76 Log.logRB(Resource.INVALALPHA, new Object [] {percent, getCommandName()}); 77 f = 256; 78 } 79 } catch( NumberFormatException e ) { 80 Log.logRB(Resource.INVALALPHA, new Object [] {percent, getCommandName()}); 81 f = 256; 82 } 83 } 84 if( inst.cxform == null ) { 85 inst.cxform = CXForm.newIdentity(true); 86 } 87 inst.cxform.setAlphaMul(f); 88 } 89 90 } 91 | Popular Tags |