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 XMLScrollingListCommand extends GeneralXMLListCommand { 64 65 public XMLScrollingListCommand() {} 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 ( orient == ORIENT_VERT ) { 80 listSize -= winHeight; 81 } else if ( orient == ORIENT_HORIZ ) { 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 ( orient == ORIENT_VERT ) { 92 matrix = AffineTransform.getTranslateInstance(0,current); 93 } else if ( orient == ORIENT_HORIZ ) { 94 matrix = AffineTransform.getTranslateInstance(current,0); 95 } else { 96 matrix = new AffineTransform(); 98 } 99 scrollFrame.addInstance(1, matrix); 100 } 101 } 102 103 firstFrame.addStopAction(); 104 myScript.getLastFrame().addStopAction(); 105 106 addMask( parent, frameNum ); 107 } 108 109 } 110 | Popular Tags |