Dumb Newbie Questions -- 1 of N
Judy Perry
jperryl at ecs.fullerton.edu
Fri May 1 15:56:47 EDT 2009
Thank you, Scott. Your explanation looks helpful :-)
Judy
On Fri, 1 May 2009, Scott Rossi wrote:
> Recently, Judy Perry wrote:
>
>> I'm trying to figure out what new (to me) things are worth spending time
>> on this summer (worth = useful for me) and which are not. I honestly do
>> not see myself doing 32,000 card stacks anytime soon as my little things
>> are just educational aids for my kids, so I thought I'd pick custom
>> properties since everyone seems to be of the opinion that they are the
>> bee's knees. Howevder, I need to see an example along the lines of the
>> sorts of things I'd be likely to use them for as well as an extremely
>> detailed set of instructions with explanations of why as well as how.
>
> Judy, maybe this analogy can help:
>
> You can think of custom properties as global variables that are tied to
> objects, instead of variables that float around in space.
>
> You know how to use globals, yes? If you script:
> global specialValues
> put "a,b,c" into specialValues
>
> ...you've created a global variable named specialValues that is accessible
> everywhere in your stack. And to use the contents of specialValues, you
> simply declare the variable and do something with it:
> global specialValues
> answer specialValues
>
> The above is similar for custom properties, except that you assign the
> "global" to an object:
> set the specialValues of btn 1 to "a,b,c"
>
> In scripting this, you have created a custom property of button 1 called
> specialValues, and you can retrieve the contents of the property anywhere in
> your stack by referencing the object to which the property is attached:
> answer the specialValues of btn 1
>
> Notice that you need to use the word "the" when accessing a custom property,
> the same way you would script "the backColor of btn 1" or "the width of btn
> 1". Now, in addition to backColor and width properties, button 1 also has a
> specialValues property -- a property you created.
>
> So while a custom property is not a global variable from a semantic
> standpoint, it does behave a bit like a global variable, but one that is
> assigned to an object, and the object can be a control, a card, or a stack.
>
> I think this has been stated before, but one reason I use custom properties
> so often in my stacks is the values stored in them are persistent across
> sessions, whereas globals need to be populated each time. I also like the
> fact that custom properties are no longer present after a stack is closed,
> unlike globals which hang around in memory until they are deleted or Rev is
> shut down.
>
> Finally, the association that can be made between and object and a custom
> property makes sense to me. I can set the "bouncing" property of a ball
> image to true or false; if I have many ball images in a stack, they can all
> have the same "bouncing" property which I can check on an object-by-object
> basis.
>
> Hope you find this somewhat useful.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, Multimedia & Design
>
>
> _______________________________________________
> 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