Island Creator/Interaction between 2D objects
From Croquet Consortium
In the previous lesson we was working only with one 2D object and we have created a script for it. But, usually, an application has many 2D objects interacting. Lets go to see a simple example of it.
Open a new project and drag, from the "Green Window", a 2D object whose name is: Button. Drag also a Textborder.
Opening the "Object Viewer" of the Button, try to find the section: Scripts and drag the line:Button emptyScript
Don't open the script yet! Open the "Object Viewer" of the Textborder and drag the line: Text(border)'s characters <- abc over the "Script Viewer" of the Button, like you can see at the Fig. 19-2:
TIP: When you open a new Object Viewer and there are another open, the previous will be hided and go to be represented by an icon, that can be clicked to reopen it.
Change the script. Our intention is: when the button is clicked, the text on the Textborder will change.
VERY IMPORTANT: Pay attention to the fact that was created a "prefix" for the Class Textborder. To call the method/function setCharacters:param. Here the "prefix" has the same name: Textborder, but could be different.
Click: normal, in the superior Bar of the Script Viewer. You will select how the script will run. The option here is: mouseDown - the click on the button.
Do an "accept" !!!
Your application is finished. You can clean the page, save the project like "proj2" etc. etc. like we did in the previous lesson.
Look, in the next figures, the application being executed by Alice, in the SanMinimum island:
You can do another test after the firt: change the text inside the Textborder to, by example: "XXXX". And click the button again.
Table of Content <...> Cobalt Wiki Main Page

