Friday, January 27, 2012

Make a button that can be enabled and disabled

To create a button:
  • click on the paint new sprite icon.
  • draw a black rectangle
  • than draw another rectangle in grey and place it slightly above so that the black rectangle looks like a shadow
  • use the text tool to put text on the button
  • click OK to save the new sprite and rename the sprite Button
  • now copy the costume and change the font color of the text on the button to a lighter color so   that it looks as if the button is disabled
  • The script for the button sprite could be something like this:
  • Remember that the button sprite cannot change the properties of the stage or any another sprite.  The only way to make such changes is to broadcast a message to the other sprites/stage to make these changes to themselves.  (attributes of an object is private and encapsulated)

No comments:

Post a Comment