Re: API Commands

Dmitry Skavish <[email protected]> Tue, 14 Oct 2003 01:59:49 -0400
Newsgroups gmane.comp.java.jgenerator.devel
Organization JZox, Inc.
Message-ID <[email protected]>
> Do you have a code snippet available of how to use a command?  Seeing an
> dexampel of setting up the instance, attaching, Getting the context,
> being done correctly would really help.
> BTW I later found the def files, and tried to set the context values,
> but that didnt seem to work, which was probably due to not having
> attched to an instance.  Again a code snippet of hoe this is done would
> really help.

Frame frame = ....;

Instance instance = frame.addInstance(new Script(), 1, null, null);

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

command.addParameter("datasource", "{fileName}");
command.addParameter("stepsize", "8");
command.addParameter(....);
....

instance.setCommand(command);

...

FlashFile file = .....;
StandardContext context = new StandardContext();
context.setValue("fileName", "c:/somedir/somefile");
context.setValue("someOtherVariableName", "someOtherVariableValue");

file.processFile(context);

FlashOutput buffer = file.generate();


> On Mon, 2003-10-13 at 06:49, Dmitry Skavish wrote:
> 
>>>Is there any documentation or examples on how to use the commands.  I
>>>tried to use the TickerCommand class but when I run my test class I get
>>>an IVException: Error reading from the datasource '' in command
>>>TickerCommand.  What datasource, I never said anything about a data
>>>source.  The code I use is:
>>>
>>>file = FlashFile.newFlashFile();
>>>StandardContext context = new StandardContext();
>>>Script script = new Script(1);
>>>script.setMain();
>>>file.setMainScript(script);
>>>TickerCommand ticker = new TickerCommand();
>>>ticker.doCommand(file, context, script, 1)
>>
>>each command needs to be passed parameters. names and types of parameters depend on 
>>command. for example if you need to pass some parameter to some command do like the following:
>>
>>context.setValue("datasource", "#name, value\n\"name1\", \"value1\"");
>>or
>>context.setValue("datasource", "c:/jgenerator/data/somedatasource.txt");
>>
>>and by the way command has to be attached to an Instance object by setting instance on the 
>>command and by setting command on the instance. don't ask ahy it's done this way, the 
>>desing was pretty much dictated by Macromedia Generator architecture and the way it worked.
>>
>>
>>>None of the classes in the command package are documented, so if there
>>>is something else I am supposed to add to the context, I have no way of
>>>knowing what it is?  And anyone answering, please dont say "feel free to
>>>document them." Because documenting someone else code is an exercise in
>>>futility.
>>
>>it's all "documented" in .def files (<jgenerator>/ext/templates/) and in corresponding 
>>chapters in Macromedia Generator documentation.
> 
> 
> 

-- 
Dmitry Skavish
email: [email protected] | cell: 508.789.6590 | office: 508.875.5564



-------------------------------------------------------
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