Switching between images...

Ken Ray kray at sonsothunder.com
Fri Aug 23 15:35:01 EDT 2002


Guys, guys... don't forget that Rev automatically senses for the rollover
when you set the "autoarm" to true. So set the 'icon' of the button to the
first image, the 'armedicon' of the button to the second image, turn the
autoarm on, and there's no script to write!

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/

----- Original Message -----
From: "Klaus Major" <klaus.major at metascape.org>
To: <use-revolution at lists.runrev.com>
Sent: Friday, August 23, 2002 11:10 AM
Subject: Re: Switching between images...


> Hi Peter,
>
> > At 4:30 AM -0700 8/23/2002, Peter Lundh wrote:
> >> Could someone please recommend a simple way to switch between two
> >> versions
> >> of the same image. The images are stacked on top of each other on a
> >> card and
> >> I would like the user to be able to toggle/switch between the two by
> >> either,
> >> clicking on them, or by doing a "mouseOver"/"rollover".
> >
> > Klaus has made some suggestions that assume you have the two images both
> > visible.
> >
> > One alternative that's often handy is to use a button instead of an
> > image,
> > and set the button's icon property to the ID of the image you want to
> > use.
> > Since an icon can be any image of any size, you can use it for things
> > other
> > than conventional icons. And since only one object (the button) is
> > actually
> > shown, it's a little more convenient if you have to move the image on
> > the
> > card (no need to worry about moving both image objects, just move the
> > button).
> >
> > Here you might create/import the two versions of the image, and either
> > hide
> > them or place them in a substack. Get their IDs (let's say they're 2001
> > and
> > 2002). Then create a blank button of the correct size, and put this in
> > the
> > button script:
> >
> >   on mouseUp -- switch from one image to the other
> >     if the ID of me is 2001 then set the ID of me to 2002
> >     else set the ID of me to 2001
> >   end mouseUp
>
> in this case you can have it even shorter (said the big TIMESAVER ;-)
> without any if...then...else...
>
> Just set the icon of the btn to the id of the first image and the
> hiliteicon
> of the button to the id of the other image.
>
> Then script:
>
> on mouseup
>    set the hilite of me to (not the hilite of me)
> end mouseup
>
> or
>
> on mouseenter
>    set the hilite of me to (not the hilite of me)
> end mouseenter
>
> and other variations...
> You get the picture...
>
> So you just need one line.
>
> If the images are not TOO big (screensize maybe) the performance
> will be as fast as ever :-)
>
>
> Regards
>
> (timesaving) Klaus Major
> klaus.major at metascape.org
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the Use-livecode mailing list