Couldn't you just check the input is a structure composed of 4 members, then check each member has a value in the 0 > 1 range? a|x
--- On Mon, 9/8/10, Achim Breidenbach <[email protected]> wrote: From: Achim Breidenbach <[email protected]> Subject: Re: .IsColor() method in Javascript ?! To: "Alastair Leith" <[email protected]> Cc: "quartzcomposer-dev list list" <[email protected]> Date: Monday, 9 August, 2010, 16:46 Hello Alastair, I googled a method that reads the object type from its constructor. Find enclosed a variant of your composition how it works. Unfortunately it says: "Number" for bool, "String" for string and "Object " for colors. But maybe this is all you need to make your decisions within your JavaScript? best, Achim BreidenbachBoinx Software On 09.08.2010, at 15:29, Alastair Leith wrote: I'm trying to find a way to recognise if a given item in a structure is a 'Color' object. I need to do this totally inside JS patch – no outside patches to help with the effort – because the JS patch needs to iterate thru 100 items in the structure (precluding a QC-patch-methodology). The closest I've got is the JS '===' comparison (which compares type as well as value and is one of a scant couple of useful, non-ubiquitous facts in the Apple Javascript docs). If I coerce the object to a String and then compare the object to it's coerced string with '===' a colour will not result in true (whereas '==' would be true) but neither will any other QC-Structure :/ Using stock patches, best method I've found is to plug the object of interest into String Components patch giving a 4 item structure if it's a color then checking first element for "R=" in first 2 char. But like I said, I need to do this inside javascript. Seems QC evaluates colors under the hood differently depending on the Patch that is receiving it: Image to String will show a colour as "R=0.123456 G=0.1234546 B=0.1233445 A=1". Putting the color through other patches like splitters makes Image to String show "<QC Structure>" instead. When a noodle porting a color is pulled off an input port of any kind of String patch, the text <NSCalibratedRGBColor> is left in the port. So many hints this could be possible but no cigars. I wish I could write even elementary plugins* this must be a few lines of code only! ;) * Read wouldn't it be great to use QC5 to write plugins and/or sample and create under-the-hood data types. <I want an IsColor?() JS method.qtz> The machine does not isolate man from the great problems of nature but plunges him more deeply into them. Antoine de Saint-Exupery _______________________________________________ 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/achim%40boinx.com This email sent to [email protected] -----Inline Attachment Follows----- _______________________________________________ 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/the_voder%40yahoo.co.uk This email sent to [email protected]
_______________________________________________ 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]

