[squeakland] How to make a button in Etoys 4.1 update 2390 change color of a morph
Mike Stramba
mikestramba at gmail.com
Wed Mar 14 16:23:01 EDT 2012
I'm trying to setup a simple etoys project with a playfield, button
and rectange.
When the button is pushed the rectangle should change color from it's
default of black to red.
1)I've dragged out a playfield, button and rectangle from the
supplies, placing the rectangle, and button inside the rectangle.
2) I opened a viewer on the button, and dragged the empty script to an
empty place on the workarea (not in the playfield), then added a test
tile, and a "button down?" condition to the test.
When viewing the script textually it shows :
------------------------
script1
ActiveHand anyButtonPressed
-----------------------------------------------------
3) I then switched the button script back to "revert to tile version"
4) I opened a viewer on the rectangle, and dragged the 'Rectangle1's
color' tile to the workarea, and tried to drop it into the Test /
"yes" slot in the button's script editor, but it doesn't accept it.
Do I need to use a variable (player type) in the button script to
reference the rectangle's color attribute ?
If so, how ?
-----------------
I could do this same thing "manually" just using a custom class
subclassed from morph, adding code to the handle down etc, but am
trying to figure out how to using the supposedly "eaier" Etoys :/
Mike
More information about the squeakland
mailing list