Hi,

I'm struggling a bit with using JavaScript within Quartz, especially how to
use and abuse the structures that can be passed into the patch.
What I'm trying to achieve is only letting a string through that matches one
of the keys in the structure.
Also, if the composition has only just been run, and no strings have been
passed the return string should be blank.

Below is an example of the structure I'm passing:

0: "left" = Structure
 0: "x" = -1
1: "y" = 0
1: "right" = Structure
0: "x" = 1
 1: "y" = 0
2: "center" = Structure
 0: "x" = 0
 1: "y" = 0

And my Javascript at the moment is:

function (__string output_cmd) main (__string input_cmd, __structure
positions)
{
 var result = new Object();
var firstRun;

if(firstRun != 1) {
 input_cmd = '';
firstRun = 1;
 }

 if (positions[input_cmd] == null) {
input_cmd = '';
 }

 result.output_cmd = input_cmd;
return result;
}

I seem to be getting an error on the if (positions[input_cmd] == null) {
line, saying that positions is not an object.

I'm also pretty sure the firstRun section is correct, as I've tested it on
it's own and it works.


So what is the correct way to work with Structures inside of a JavaScript
patch?

Regards,
Charlie
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to