Turning graphic effects off and on

Devin Asay devin_asay at byu.edu
Mon Dec 9 15:22:22 EST 2013


On Dec 9, 2013, at 12:43 PM, Scott Rossi wrote:

> Not sure where the IDE is saving graphic effects settings, but basically
> using the checkbox removes the graphic effect.
>  set the colorOverlay of the btn "foo" to empty
> 
> If you don't need to rely on the IDE, you can store the graphic effect
> settings in a custom property or variable (it's an array).
> 
> You can test whether a graphic effect has been applied to an object by
> checking the array.
>  if the dropshadow of btn "foo" is an array then…

Right, I know about setting the effect to empty, but it's the saving of the graphic effect settings that's tripping me up. Shouldn't something like this work:

  set the colorOverlay_save of btn "foo" to the colorOverlay of btn "foo"
  --> I thought this would save the array to a new customProp, but it just creates an empty custom prop 
  set the colorOverlay of btn "foo" to the colorOverlay_save of btn "foo"

Then I thought, maybe creating a custom property set will work:

  set the colorOverlay_save["color"] of btn "foo" to the colorOverlay["color"] of btn "foo"
  set the colorOverlay_save["blendMode"] to the colorOverlay["blendMode"] of btn "foo"
  set the colorOverlay_save["opacity"] to the colorOverlay["opacity"] of btn "foo"
  --> Yes, the custom prop set gets created, but this doesn't work:
  set the colorOverlay of btn "foo" to the colorOverlay_save of btn "foo"
  --> shouldn't this work? It doesn't

Then I thought, I'll just iterate through the keys of the colorOverlay property. 'put the keys of the colorOverlay of btn "foo" yields nothin', at least in the message box.

The only thing that works is explicitly naming the keys:
  set the colorOverlay["color"] of btn "foo" to the colorOverlay_save["color"] of btn "foo"
  set the colorOverlay["blendMode"] to the colorOverlay_save["blendMode"] of btn "foo"
  set the colorOverlay["opacity"] to the colorOverlay_save["opacity"] of btn "foo"

So it looks like a modified version of Richmond's "steam shovel" approach is the best.

I know that the custom property set of an object is an array, and that a custom property of an object can *hold* an array, but somehow they aren't as handy to work with as arrays in variables. :(

Off to the steam shovel…

Regards,

Devin

Devin Asay
Learn to code with LiveCode University
http://university.livecode.com





More information about the use-livecode mailing list