Re: API Commands

Dave Patton <[email protected]> 14 Oct 2003 11:42:56 -0700
Newsgroups gmane.comp.java.jgenerator.devel
Message-ID <[email protected]>
Thanks for the code snippet.  I followed it to the letter but it still
does not work.  It throws a NullPOinterException when I call
file.generate()  What am I missing?  Here is my code


         Util.init("../classes");
         System.out.println("Starting TickerTest");
         FlashFile file = FlashFile.newFlashFile(); // create default
flash file
         Script script = new Script(); // create main script with 1
frame
         script.setMain();
         file.setMainScript(script); // set main script for the file
         //int startFrame = 1;
         //Frame frame = script.getFrameAt(1);
         Frame frame = new Frame();
         Instance instance = frame.addInstance(script, 1, null, null);

         GenericCommand command = new TickerCommand();
         command.setInstance(instance);

         command.addParameter("datasource", "text.txt");
         command.addParameter("orient", "horizontal");
         command.addParameter("mask", "false");
         command.addParameter("stepsize", "8");
         command.addParameter("itemspace", "5");
         command.addParameter("halign", "left");
         command.addParameter("valign", "top");
         command.addParameter("instancename", "");

         instance.setCommand(command);
         StandardContext context = new StandardContext();
         context.setValue("filename", "tickertest.swf");
         System.out.println("GOT HERE");
         file.processFile(context);
         FlashOutput fob = file.generate();
         BufferedOutputStream bos = new BufferedOutputStream(new
FileOutputStream("tickertest.swf"));
         bos.write(fob.getBuf(), 0, fob.getSize());
         bos.close();
         System.out.println("Wrote File");


I am still unclear on the context.  What sort of parameters would I pass
to it.  I am not a Flash person so alot of this is new to me.


Dave Patton





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php