Another problem:

if(Store = true && StoreIndex > 0)

should be

if(Store == true && StoreIndex > 0)


Keeping data persistent can be done with the Object object. Test for a null value first.

if (Object.myObject == null)
{
        Object.myObject = 0;
}

the object will be persistent

another technique:

if (Object.init == null)
{

        xx = [];  // define new object

        xx.a = 1;
        xx.b = 2;
        xx.c = 3;

        Object.init = true;
}

both Object.init and xx will be persistent.

Dave C.


Message: 1
Date: Tue, 18 Dec 2007 13:13:08 +0000 (GMT)
From: Alex Drinkwater <[EMAIL PROTECTED]>
Subject: Re: Storing Structs
To: [email protected]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

I've been doing some tests on this myself, and have
come up with the following JavaScript.

It doesn't work, however.
I'm sure it's to do with the way I initialise the
'presets' Array. I haven't used Arrays a lot in
JavaScript, so I'm a bit confused. If someone could
point me in the right direction, I'd be really
grateful.

I need to be able to store 5 different values for the
'Parameters' struct/array in 'presets'.
Presets are stores when 'Store'=true, into the memory
location defined by 'StoreIndex', and the output is
set by 'RecallIndex'.

I've attached the QTZ also.

Cheers again,

alx

/*
Stores Parameters in 1 of x number of 'memory
loactions'.
Parameters input should be a structure in the form
{
"Parameter 1" : value1,
"Parameter 2" : value2
}
*/

function (__structure OutputStruct) main (__structure
Parameters, __boolean Store, __number StoreIndex,
__number RecallIndex)
{
        // Initialise output object
        var result = new Object();
        
        // Number of memory locations
        var memories = 5;

        // Initialise presets array
        var presets = new Array();
        
        if(Store = true && StoreIndex > 0) {
                presets[StoreIndex] = Parameters;
        };
                
        result.OutputStruct = presets[RecallIndex];
        return result;
}


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

This email sent to [EMAIL PROTECTED]

Reply via email to