Image woes

Dave dave at looktowindward.com
Wed Nov 15 07:52:07 EST 2006


Hi,

Glad I could be of help!

This is one of the types of code re-use problems that ISM solves  
almost automatically. In this case objects in a stack need to  
communicate with another object (the last image in this case). A way  
to have made this safer would have been to name the image with a  
(hopefully) unique name and instead of writing:

last image you'd write image "UniqueName"

Which would work, but then you'd run into problems if you had another  
object called  "UniqueName. ISM solves this as so:

At system initialization a function called ISMInitializeObject is  
called in each object in a stack/card if "ISMInitializeObject" is  
contained in that object. So in this case the Trevor's Last Image  
would send a message announcing it's object long name (e.g.Key=  
"Trevor_SpecialImage1,value="stack/card/group/object" long name" in  
this case), then when the code needed to access the image, it would  
call ISM to get the message  "Trevor_SpecialImage1" and use the long  
name to access it, thereby always getting the correct object  
regardless of where it is in stack, card, group etc. If the value is  
needed Immediately it is changed, then the objects that need the new  
value would "Listen" for the message "Trevor_SpecialImage1" and  
specify a function to call when it is changed.

Trevor (the developer of the object) would be assigned a unique  
prefix for their objects, so in this case it might be "Trevor_" then  
as long as Trevor maintained his messages (message keys) correctly,  
then anyone could literally drop them into their project and they  
would just "work" with no code or IDE changes. All the user of  
Trevor's code would need to know is the messages that are exported  
(sent) from the objects they were using and to add the appropriate  
code to objects that either set (sent) or obtained (received) values  
from Trevor's objects in their own stacks.

All the Best
Dave

On 15 Nov 2006, at 12:19, Scott Kane wrote:

> Dave,
>
>> One other thought. Is this a multi-card stack? If so is Trevor's   
>> image supposed to reside in just card one or in all cards? If all   
>> cards, you might have to make it into a group and set the "Group   
>> Background Behavior" to on. You would also have to make sure it's  
>> the  last Group in all cards. Either that or dupe it into each card.
>
> Now there is a thought!!  Yes - the images are unique to each  
> card.  Trevors stack is setup in groups.  When I add the button  
> images the problem starts, so it would stand to reason that "last  
> image" is going to be the button icons which are in a different group.
>
> Time for bed now, but I'll give it a try in the morning.
>
> Thanks!!
>
> Scott
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list