OK, here’s a weird-ity. I’m working on a simple game, and it uses sounds and graphics. I’ve gotten along fine with the sounds by using a property to store the sound reference from
set explodeSnd to load sound "explode"
and put it in my awake from nib handler so I don’t have to keep loading the same sound and then disposing of it. Later, in the game, I just use
play explodeSnd
and everthing works.
However, I’ve discovered that the load image command won’t work that way (at least it’s not working for me). I’ve got the global property saving the image reference in the awake from nib handler like this:
set screen1Img to load image "nebula.jpeg"
but when I try to call it later like this:
set image of image view "viewScreen" to screen1Img
I get a “Can’t Create Script” error. I had to go back to this usage:
set image of image view "viewScreen" to load image "nebula.jpeg"
to make it work.
So, my question is, am I using memory to reload these images? Or when I load the exact same image 6 times during the course of a game, does it overlay in the same memory space?
(…and, if the handle reference works for sounds, why doesn’t it work for images? The sound definition in the Terminology guide even points to the load image page to explain how it works.:/)
Model: iMac DV+
AppleScript: 1.9.1
Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060214 Camino/1.0
Operating System: Mac OS X (10.2.x)