Using Regular Expressions
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 happens is that no matter which Rectangle the mouse enters, the other three will fade to Alpha 0.5.
In the Skin Editor:
-
Add four Rectangles to the skin. Name them Rectangle 1, Rectangle 2, Rectangle 3, and Rectangle 4.
-
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. -
Add the following actions to Rectangle 1:
Source Action Type Alpha Target Mouse Enter Alpha Change Element Alpha 1.00 _self
Mouse Enter Alpha Change Element Alpha 0.50 #Rectangle [2-4]
-
Add the following actions to Rectangle 2:
Source Action Type Alpha Target Mouse Enter Alpha Change Element Alpha 1.00 _self
Mouse Enter Alpha Change Element Alpha 0.50 #Rectangle [13-4]
-
Add the following actions to Rectangle 3:
Source Action Type Alpha Target Mouse Enter Alpha Change Element Alpha 1.00 _self
Mouse Enter Alpha Change Element Alpha 0.50 #Rectangle [1-24]
-
Add the following actions to Rectangle 4:
Source Action Type Alpha Target Mouse Enter Alpha Change Element Alpha 1.00 _self
Mouse Enter Alpha Change Element Alpha 0.50 #Rectangle [1-3]
Characters in Regular Expressions
The following characters are used to modify the number range that needs to be addressed; as in leaving out certain numbers while including others.
1-3
means elements from range 1 to 3 are included. 13-4
means elements 1, 3 to 4 are included, while 2 is not.
#Rectangle [134]
addresses Rectangles 1, 3, and 4.
★ 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 = Visibility; 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 = Visibility; Type = Show Element; Target =
#Rectangle (0[0-9]|1[0-9])
To address 00 to 29 add another OR block:
- Source = Mouse Click; Action = Visibility; 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 = Visibility; 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 = Visibility; 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 = Visibility; Type = Show Element; Target =
#Rectangle (a[a-z]|b[a-z]|c[a-z])