1 50 51 package org.openlaszlo.iv.flash.api.action; 52 53 import java.io.PrintStream ; 54 import org.openlaszlo.iv.flash.util.*; 55 import org.openlaszlo.iv.flash.parser.*; 56 import org.openlaszlo.iv.flash.api.*; 57 import org.openlaszlo.iv.flash.context.Context; 58 59 67 public class InitClipAction extends FlashObject { 68 69 private Program program; 70 private FlashDef def; 71 72 public InitClipAction() {} 73 74 public InitClipAction( FlashDef def, Program program ) { 75 this.def = def; 76 this.program = program; 77 } 78 79 public int getTag() { 80 return Tag.INITCLIPACTION; 81 } 82 83 public Program getProgram() { 84 return program; 85 } 86 87 public void setProgram( Program program ) { 88 this.program = program; 89 } 90 91 public FlashDef getClip() { 92 return def; 93 } 94 95 public void setClip( FlashDef def ) { 96 this.def = def; 97 } 98 99 public static InitClipAction parse( Parser p ) { 100 FlashDef clip = p.getDef(p.getUWord()); 101 Program prg = new Program(p.getBuf(), p.getPos(), p.getTagEndPos()); 102 return new InitClipAction(clip, prg); 103 } 104 105 public void write( FlashOutput fob ) { 106 fob.writeTag(Tag.INITCLIPACTION, program.getLength()+2); 107 fob.writeDefID(def); 108 program.write(fob); 109 } 110 111 public void printContent( PrintStream out, String indent ) { 112 out.println( indent+"InitClipAction: clipID="+def.getID() ); 113 program.printContent( out, indent+" " ); 114 } 115 116 public void apply( Context context ) { 117 super.apply( context ); 118 program.apply(context); 119 } 120 121 protected boolean _isConstant() { 122 return program.isConstant(); 123 } 124 125 public void collectDeps( DepsCollector dc ) { 126 dc.addDep(def); 127 } 128 129 protected FlashItem copyInto( FlashItem item, ScriptCopier copier ) { 130 super.copyInto( item, copier ); 131 ((InitClipAction)item).def = copier.copy(def); 132 ((InitClipAction)item).program = (Program) program.getCopy(copier); 133 return item; 134 } 135 136 public FlashItem getCopy( ScriptCopier copier ) { 137 return copyInto( new InitClipAction(), copier ); 138 } 139 140 } 141 142 143 | Popular Tags |