1 50 51 package org.openlaszlo.iv.flash.api.action; 52 53 import java.io.PrintStream ; 54 55 import org.openlaszlo.iv.flash.util.*; 56 import org.openlaszlo.iv.flash.parser.*; 57 import org.openlaszlo.iv.flash.api.*; 58 import org.openlaszlo.iv.flash.context.Context; 59 60 65 public class ClipAction extends FlashItem { 66 67 public static final int LOAD = 0x0001; 68 public static final int ENTER_FRAME = 0x0002; 69 public static final int UNLOAD = 0x0004; 70 public static final int MOUSE_MOVE = 0x0008; 71 public static final int MOUSE_DOWN = 0x0010; 72 public static final int MOUSE_UP = 0x0020; 73 public static final int KEY_DOWN = 0x0040; 74 public static final int KEY_UP = 0x0080; 75 public static final int DATA = 0x0100; 76 public static final int MXCOMPONENT = 0x0200; 77 78 private int flags; private Program program; 81 public ClipAction() {} 82 83 89 public ClipAction( int flags, Program program ) { 90 this.flags = flags; 91 this.program = program; 92 } 93 94 public void setFlags( int flags ) { 95 this.flags = flags; 96 } 97 98 public void setProgram( Program program ) { 99 this.program = program; 100 } 101 102 public int getFlags() { 103 return flags; 104 } 105 106 public Program getProgram() { 107 return program; 108 } 109 110 public void apply( Context context ) { 111 program.apply( context ); 112 } 113 114 public boolean isConstant() { 115 return program.isConstant(); 116 } 117 118 public void write( FlashOutput fob ) { 119 int version = fob.getFlashFile().getVersion(); 120 121 if( version > 5 ) fob.writeDWord(flags); 122 else fob.writeWord(flags); 123 124 fob.writeDWord( program.getLength() ); 125 program.write(fob); 126 } 127 128 public void printContent( PrintStream out, String indent ) { 129 out.println( indent+" ClipAction: flags=0x"+Util.w2h(flags) ); 130 program.printContent(out, indent+" "); 131 } 132 133 public FlashItem getCopy( ScriptCopier copier ) { 134 return new ClipAction( flags, (Program) program.getCopy(copier) ); 135 } 136 137 } 138 139 | Popular Tags |