Dynamic Properties Sample
Expressions are ideal for working with several objects that rely upon a particular value, such as a script variable, rather than the measurements of other objects. In this sample, four DIV elements have been positioned around a fifth, larger DIV. The four smaller DIV elements are positioned using the measurements of the the center DIV and a script variable, iOffset. When the center DIV is moved around the screen (just click and drag), the four smaller DIV elements move in unison. Rather than write script to move the four smaller elements, expressions are used based upon the location of the fifth element. In addition to accounting for the changing location of the center element, the four smaller elements also take into account the value of the script variable used for the offset. If you change the value in the text field below, the offset values are changed without having to reset the positions.