Firstly the CALayer class is part of the QuartzCore Framework which will have to be imported into you’re project, as the standard ASOC project template only uses the standard Cocoa frameworks like Foundation and AppKit and ApplescriptObjC ect.
Secondly I beleive the QuartzCore framework is written in the C++ language, so it may not be accessible with the ASOC language, which I also believe can only access framework classes written in Objective-C, but I could be wrong with that opinion.
also your code example has missing braces for the method calls, and is also trying to call a setBackgroundColor() method on a CALayer which does not have a setBackgroundColor() method, only a backgroundColor property.
you’ve written this.
myWindow's contentView's layer's setBackgroundColor_(myColor)
To access the Window’s layer would be more like this.
set theLayer to myWindow's contentView()'s layer()
On the few occasions I’ve worked with the CALayer class in ObjC projects, I’ve accessed and modified it’s properties with the dot syntax like the example below, which is why I suspect it’s class is written with the C++ language.
Also most of the examples I’ve read in books and online also seem to all use this dot syntax.
CALayer *myLayer = [CALayer layer];
myLayer.anchorPoint = CGPointZero;
theLayer.position = CGPointMake(10, 10);
myLayer.backgroundColor = CGColorGetConstantColor(kCGColorClear);
ect.
This code is not valid code in an ASOC project, so dont try to use it in your own project, but I’ve posted it so that the more experienced ASOC coders that hang out here, may be able to show how to translate this type of syntax to ASOC code.
Lastly I think you can also use the NS classes for your CGRef’s as they are toll free bridged by the Scripting Bridge, for example the NSColor has a CGColor method, and the NSMakePoint() method is bridged to the CGPointMake() method by the scripting bridge, but I’ve not tested it in an ASOC project, maybe again one of the other members could confirm this.
set myColor to current application's NSColor's clearColor()
myLayer.backgroundColor = (myColor's CGColor())
Sorry I could not be help more, but maybe some of my points may help in some way, If I get a chance this week I’ll create a new ASOC project and play around myself with a CALayer class, and let you know if I have any joy.
Regards Mark