1 50 51 package org.openlaszlo.iv.flash.commands; 52 53 import java.io.*; 54 import java.awt.geom.*; 55 56 import org.openlaszlo.iv.flash.parser.*; 57 import org.openlaszlo.iv.flash.api.*; 58 import org.openlaszlo.iv.flash.api.action.*; 59 import org.openlaszlo.iv.flash.util.*; 60 61 import org.openlaszlo.iv.flash.context.Context; 62 63 public class ScrollingListCommand extends GeneralListCommand { 64 65 public ScrollingListCommand() {} 66 67 public void doCommand( FlashFile file, Context context, Script parent, int frameNum ) throws IVException { 68 initParms( context ); 69 70 int stepsize = getIntParameter( context, "stepsize", 4 ) * 20; 71 72 Script listScript = makeList( file, context, parent, frameNum ); 73 74 Script myScript = getInstance().copyScript(); 75 Frame firstFrame = myScript.newFrame(); 76 firstFrame.addInstance(listScript, 1, new AffineTransform(), null, "contents" ); 77 78 if( stepsize > 0 ) { 79 if( isVertical ) { 80 listSize -= winHeight; 81 } else { 82 listSize -= winWidth; 83 } 84 int scrollFrames = listSize/stepsize; 85 int current = 0; 86 87 for( int i=0; i<scrollFrames; i++ ) { 88 Frame scrollFrame = myScript.newFrame(); 89 AffineTransform matrix; 90 current -= stepsize; 91 if( isVertical ) { 92 matrix = AffineTransform.getTranslateInstance(0,current); 93 } else { 94 matrix = AffineTransform.getTranslateInstance(current,0); 95 } 96 scrollFrame.addInstance(1, matrix); 97 } 98 } 99 100 firstFrame.addStopAction(); 101 myScript.getLastFrame().addStopAction(); 102 103 addMask( parent, frameNum ); 104 } 105 106 } 107 | Popular Tags |