Regular Expressions in Action

Regular expressions let you address multiple elements within the Skin Editor with just one action. This will save time when setting up thumbnails or any other multiple element project.

Learn how to address multiple elements using the following example. You’ll add four rectangles to the skin and you’ll add regular expressions to their Target fields. What will happen is that no matter which rectangle the mouse enters, the other three will fade to Alpha 0.5.

In the Skin Editor:

  1. Add four rectangles to the skin. Name them Rectangle 1, Rectangle 2, Rectangle 3, and Rectangle 4.
  2. Set the Alpha of each to 0.5.
    Tip: Change the Alpha setting of all Rectangles at the same time by selecting them all in the Tree, and setting the Alpha.

  3. Add the following actions to Rectangle 1:
    Source = Mouse Enter; Action = Alpha; Type = Change Element Alpha; Alpha: 1; Target: _self
    Source = Mouse Enter; Action = Alpha; Type = Change Element Alpha; Alpha: .5; Target: #Rectangle [2-4]

  4. Add the following actions to Rectangle 2:
    Source = Mouse Enter; Action = Alpha; Type = Change Element Alpha; Alpha: 1; Target: _self
    Source = Mouse Enter; Action = Alpha; Type = Change Element Alpha; Alpha: .5; Target: #Rectangle [13-4]

  5. Add the following actions to Rectangle 3:
    Source = Mouse Enter; Action = Alpha; Type = Change Element Alpha; Alpha: 1; Target: _self
    Source = Mouse Enter; Action = Alpha; Type = Change Element Alpha; Alpha: .5; Target: #Rectangle [1-24]

  6. Add the following actions to Rectangle 4:
    Source = Mouse Enter; Action = Alpha; Type = Change Element Alpha; Alpha: 1; Target: _self
    Source = Mouse Enter; Action = Alpha; Type = Change Element Alpha; Alpha: .5; Target: #Rectangle [1-3]

Characters in Regular Expressions

The following characters can be used to modify the number range that needs to be addressed; so leaving out certain numbers while including others.

1-3 means elements from range 1 to 3 are included.
13-4 means elements 1 and 3 to 4. 2 is not included.

#Rectangle [134] will address Rectangles 1, 3, and 4.
Note: The Target ID must be preceded with the pound/hash character #.
Use the pipe character | to separate element IDs. For example, to set two different elements to be visible:

  • Source = Mouse Click; Action = Visibility; Type = Show Element; Target = #Rectangle [134]|Button 2

  • Source = Mouse Click; Action = Visibility; Type = Show Element; Target = #Rectangle [134]|Button [2-8]

Using the Wild Card

The asterisk * can be used to address all elements within a range. To hide all rectangles in the skin:

  • Source = Mouse Click; Action = Visiblity; Type = Hide Element; Target = #Rectangle .*

Using more then one character to address many elements

If many elements in the skin need to be addressed, then the pipe | can be used as an OR. This also requires the variables to be in brackets, ( ).

To address rectangles 00 to 19:

  • Source = Mouse Click; Action = Visiblity; Type = Show Element; Target = #Rectangle (0[0-9]|1[0-9])

To address 00 to 29 add another OR block:

  • Source = Mouse Click; Action = Visiblity; Type = Show Element; Target = #Rectangle (0[0-9]|1[0-9]|2[0-9])

To exclude rectangle 15, but address the rest:

  • Source = Mouse Click; Action = Visiblity; Type = Show Element; Target = #Rectangle (0[0-9]|1[0-4/6-9])

Using letters will let you address more elements. aa to zz will give you 52 elements that can be addressed.

An example of the naming convention of the elements in the skin:

  • Rectangle aa
  • Rectangle az
  • Rectangle ba
  • Rectangle bz

An example of addressing all elements except for Rectangle bc.

  • Source = Mouse Click; Action = Visiblity; Type = Show Element; Target = #Rectangle (a[a-z]|b[abd-z])

To increase the amount of elements that can be addressed add another OR block. This can address 78 skin elements in a single action, aa to cz:

  • Source = Mouse Click; Action = Visiblity; Type = Show Element; Target = #Rectangle (a[a-z]|b[a-z]|c[a-z])

See also