Object Properties
|
Top Previous Next |
1. | Load file "button1.swi". Create an Input Text Object called Xin. (See previous tutorial for more detail). Save the file as "myproperties.swi".
|
Select the right-justified text option.
|
2. | Create similar Text Objects called Yin, xscalein, yscalein, alphain, rotationin, visiblein. You can create the new Objects using the Text Tool, or by copying and pasting the Xin Text Object and renaming it
|
3. | Add static text titles for the input boxes and re-arrange as shown below. You may find this easier if you enable Snap To Grid
|
4. | Add Dynamic Text Objects heightout, widthout and nameout. Add corresponding static text titles for the new fields.
|
5. | Use the Autoshape Tool to draw an arrow ![]() ![]() ![]() |
6. | Select the arrow shape in the 'Outline' Panel and select the Script tab to add an onLoad() Event Handling function for the arrow. This function will be used to initialise the Input and Dynamic text values
|
7. | Add a name=expr; type statement to the onLoad() Event function.
|
For the 'Target:' parameter, select _parent.Xin from the pull-down list.
|
For the 'Name:' parameter, select Text | text from the pull-down list.
|
Leave the operator as =.
|
Enter the formula _X. This formula or value can also be entered by right clicking in the formula field then selecting the properties Menu item.
|
The resulting function should look like this:
|
8. | In a similar way, expand the onLoad function so that it contains the following statements:
|
|
_parent.Xin.text = _X;
|
_parent.Yin.text = _Y;
|
_parent.xscalein.text = _xscale;
|
_parent.yscalein.text = _yscale;
|
_parent.alphain.text = _alpha;
|
_parent.rotationin.text = _rotation;
|
_parent.visiblein.text = _visible;
|
_parent.heightout.text = _height;
|
_parent.widthout.text = _width;
|
_parent.nameout.text = _name;
|
When the function is executed, the arrow properties will be assigned to the text property of the Input and Dynamic Text Objects
|
|
arrow._X = Xin.text;
|
arrow._Y = Yin.text;
|
arrow._xscale = xscalein.text;
|
arrow._yscale = yscalein.text;
|
arrow._rotation = rotationin.text;
|
arrow._alpha = alphain.text;
|
arrow._visible = visiblein.text;
|
|
Do this by selecting the 'b1' button in the 'Outline' Panel.
|
|
The on (press) function should appear as shown:
|
When this function is executed, the arrow properties will be updated with new values obtained from the text property of the various input Text Objects
|
11. | Select the 'Layout' tab and press the 'Play' button. The initial properties of the arrow Object should be displayed.
|
It is possible to alter the X, Y, xscale, yscale, rotation and visible settings. If you modify those settings while the movie is playing then press the "=" button, the arrow with the revised settings will be displayed.
|