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 import java.io.*; 60 import java.awt.geom.*; 61 62 public class XMLTickerCommand extends GeneralXMLListCommand { 63 64 public XMLTickerCommand() {} 65 66 public void doCommand( FlashFile file, Context context, Script parent, int frameNum ) throws IVException { 67 initParms( context ); 68 69 int stepsize = getIntParameter( context, "stepsize", 4 ) * 20; 70 71 Script listScript = makeList( file, context, parent, frameNum ); 72 73 Script myScript = getInstance().copyScript(); 74 75 int scrollFrames = stepsize==0?1:(listSize+Math.abs(stepsize)-1)/Math.abs(stepsize); 76 77 int current = 0; 78 for( int i=0; i<scrollFrames; i++ ) { 79 Frame scrollFrame = myScript.newFrame(); 80 AffineTransform m; 81 82 if ( orient == ORIENT_VERT ) { 83 m = AffineTransform.getTranslateInstance(0,current); 84 } else if ( orient == ORIENT_HORIZ ) { 85 m = AffineTransform.getTranslateInstance(current,0); 86 } else { 87 m = new AffineTransform(); } 89 90 if( i==0 ) scrollFrame.addInstance(listScript, 1, m, null, "contents" ); 91 else scrollFrame.addInstance(1, m); 92 93 if ( orient == ORIENT_VERT ) { 94 m = AffineTransform.getTranslateInstance(0,current+listSize); 95 } else if ( orient == ORIENT_HORIZ ) { 96 m = AffineTransform.getTranslateInstance(current+listSize,0); 97 } else { 98 m = new AffineTransform(); } 100 101 if( i==0 ) scrollFrame.addInstance(listScript, 2, m, null, "contents2" ); 102 else scrollFrame.addInstance(2, m); 103 104 current -= stepsize; 105 } 106 107 addMask( parent, frameNum ); 108 } 109 110 } 111 | Popular Tags |