well my application is very simple. is just a window witha an image view and buttons representing the different subway lines of my city. included with the application are images of maps of each line. now i only made one buttone for one line so far to test it out. when i build it, it builds successfully. now when i hit the button to display the map i get this error. “Can’t make current application into type «class imaA». (-1700)”
can anyone please help?
Greetings.
Could you please post the code in your ‘on clicked’ handler that you are executing? I’ve never seen this error before, but unless you’ve somehow corrupted the nib file, you are probably referencing an object incorrectly, or are making something more difdficult than it needs to be. There’s no way for us to tell what’s wrong with your code if we can’t see it, though.
j
ok i got it to work with one button now i cant get it to work with the second and i used if statements.
on clicked theObject
if the name of theObject is “train” then
set image of image view “Map” of window “main” to load image “blah”
if the name of theObject is “fl” then
set image of image view “Map” of window “main” to load image “F”
end if
end clicked
You must either use an if/else statement, or use multiple if statements. I’d recommend using if/else, as there are few occassions where you’d want to evaluate more than one condition or control at a time in the same handler. So, your second if statement must be preceded by an ‘else’, to make it part of one statement…
on clicked theObject
if the name of theObject is "train" then
set image of image view "Map" of window "main" to load image "blah"
else if the name of theObject is "fl" then
set image of image view "Map" of window "main" to load image "F"
end if
end clicked
An insight:
When creating an application that loads many images, it is wise to release (delete) images as they are no longer needed. Applescript studio projects do not automatically do this when the image in a view changes, so you must do it explicitly yourself. See the notes and sample code in the “Discussion” section of apple’s ‘load image’ doc page online, or in your xcode help pages, for more information.
Good luck,
j