coerce returned value to an NSimage ?


I have an applescript subclass using a loop to create a serie of NSimage and store them inside a simple list. (It is subclassed as i use several instances of that ‘object’ in an NSArrayController / NSTableView)

I have no problem to recall any NSImage locally (inside the class I created) but if I write a handler to return a specific NSImage back into my main delegate script, it will obviously not see it as an NSimage anymore and produce an error when I try to use it :
‘NSImageCell’s object value must be an NSImage’

I am not sure there is any way in AppleScript Obj-C to coerce a returned value back to an NSimage… the solution might be to convert it to another format (NSData ?) but I fear it would slow everything down (trying to get realtime playback here that’s why I started using a buffered list of images)… and not sure how I would do the encode/decode anyway.

Other solution might be to use the NSImage directly inside my custom class (to display it) instead of passing it back to the main script but would love to hear any other solution to this.

Thanks much for any hints