At 10:02 PM -0700 7/28/2001, Troy Rollins wrote:
>Ishell has a built in capability to take a single image that contains
>multiple button states, separate states are each contained in a "cell" which
>is the same size - sort of an image that is a table of images. Note that it
>can contain, and usually does contain, an alpha channel as well.
>
>Flipbooks are used in many ways in iShell, but one of the most common is for
>buttons. The standard state of a button may be (row1, column 1), but you can
>easily change states say by mouse over. In Rev terms it would probably look
>like -
>
>On mouseOvers
>Set the state of flipbook "myButton" to (row2, column 1)
>-- this shows a highlighted state for the button
>End mouseOver

OK, I think I've got it. Thanks for the clear explanation!

The nearest equivalent in Revolution would probably be the icon property of
a button. You can set the icon (and also the hiliteIcon, for the
highlighted state) of a button to be the ID of any available image. That
image can be in Rev's image library, in your stack, or in any open stack.
The image itself need not be visible, and you can set the icon "on the fly"
to respond to messages.

For example, suppose I have three image files for a custom button: one for
the normal state, one for when the mouse is inside the button, and one for
when it's pressed. I can import these into my stack, then hide the images
so they'll be out of the way. (Or, for easier handling, I might create a
substack just for my button images and import them into that substack.
Either way, the images will be loaded into memory whenever my main stack is
open.)

Next I create a blank button and set its icon property to the "normal
state" image, and its hilitedIcon property to the ID of the "pressed state"
image. Thus far, Revolution handles the switching of images automatically,
with no scripting required.

If I want to switch images at other times - for example, to switch to a new
image when the mouse enters the button - I can set the icon property in a
script in the button:

  on mouseEnter
    set the icon of me to 12443 -- ID of the "mouseover state" image
  end mouseEnter

  on mouseLeave
    set the icon of me to 34222 -- ID of the "normal state" image
  end mouseLeave

If you have a lot of images you're doing this with, one way to set it up is
to create a substack to hold the images, then create a separate card for
the images associated with each button, and give each card the same name as
the button it's associated with. This lets you easily find the images
associated with a button.

Finally, for ease of reading, you can name the images and use the names to
get the IDs:

set the icon of button "This Button" to the short ID of \
   image "Mouseover" of card "This Button" of stack "My Button Images"

--
Jeanne A. E. DeVoto ~ [EMAIL PROTECTED]
http://www.runrev.com/
Runtime Revolution Limited - Power to the Developer!


Reply via email to