Button Image Binding

I have a button that when click will change it’s title from Start to Stop. I also wanted to have a green image in front of the Start title and a red image in front of the Stop title. The title changes but I can’t get the image to work.
I have the image binding for the button with model Key Path as StartStopButtonImage.

My applescript looks like this…


 property StartStopButtonImage : missing value   
    property StartStopButtonTitle : "Start"
    
    on buttonClicked_(sender)
        if (StartStopButtonTitle as string) is "Start" then
            set my StartStopButtonTitle to "Stop"
            set my StartStopButtonImage to "RedButton"
            
        else if (StartStopButtonTitle as string) is "Stop" then
            set my StartStopButtonTitle to "Start"
            set my StartStopButtonImage to "GreenButton"
        end if
    end buttonClicked_

Hi,

the expected class of the image binding is an image (NSImage) not a string
so try something like


set my StartStopButtonImage to current application's NSImage's imageNamed:"GreenButton"

That makes it work, thanks!