scripting-tutorial-$17.lzx
<canvas width="100%" height="200">
<window x="100" y="60" title="Window 2" name="windowTwo" id="windowTwoId">
<method name="moveWindow" args="buttonObj">
var direction = buttonObj.direction;
var distance = parseInt(buttonObj.distance);
// decide which direction to go
if (direction == "left") {
var increment = -1 * distance;
} else if (direction == "right") {
var increment = distance;
}
var originalX = this.x;
var newX = originalX + increment;
this.setAttribute('x', newX);
</method>
<text>This is the second window.</text>
</window>
<window x="20" y="20" width="300" title="Simple Window">
<simplelayout axis="x" spacing="4"/>
<button onclick="windowTwoId.moveWindow(this)">Left 2
<attribute name="direction" value="'left'
"/>
<attribute name="distance" value="'2'
"/>
</button>
<button onclick="windowTwoId.moveWindow(this)">Left 20
<attribute name="direction" value="'left'
"/>
<attribute name="distance" value="'20'
"/>
</button>
<button onclick="windowTwoId.moveWindow(this)">Right 20
<attribute name="direction" value="'right'
"/>
<attribute name="distance" value="'20'
"/>
</button>
<button onclick="windowTwoId.moveWindow(this)">Right 2
<attribute name="direction" value="right
" type="string"/>
<attribute name="distance" value="'2'
"/>
</button>
</window>
</canvas>
Cross References
Named Instances