Change image on mouseOver rectangle

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
calmrr3
Posts: 100
Joined: Mon Oct 28, 2013 2:39 pm

Change image on mouseOver rectangle

Post by calmrr3 » Wed Nov 06, 2013 9:44 pm

Hello,

I have a list of images numbered from 1-50 (1.jpg-50.jpg).
They form a 360 degree panorma.
When the card is opened the middle image (25.jpg) will be displayed.

Image

On the left of the image there is a rectangle and there is also one on the right hand side of the image.
I am trying to make it so that when the mouse is within the left hand rectangle the image displayed will change with the filename descending (25.jpg,24.jpg,23.jpg...1.jpg, then restart at 50.jpg,49.jpg etc) in order to create a stop-motion style effect of panning left.

Then I will repeat the with the right hand rectangle in order to give the effect of panning right.

I've had a go at guessing what the script applied to the left hand rectangle may look like (I've made some of it up as I don't know if there is a livecode equivalent of what I am trying to do).

Code: Select all

  on mouseOver
       send "showNext" to me in 0.2 seconds
       put the result into sMessageID
    end mouseOver

on mouseLeave
    if "showNext" is among the items of the pendingMessages then
       cancel sMessageID
    end if
end mouseLeave

    on showNext
        go to current image -1  
    end showNext
Thanks :)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Change image on mouseOver rectangle

Post by dunbarx » Wed Nov 06, 2013 10:05 pm

I would use the "mouseMove" message, tracking the horizontal component of the mouseLoc. This can be scaled to access the 25 images, either on the low or high side of your baseline, and display that image in the center. Do you see? If the h-component is halfway through the left rectangle, this would scale to about the 12th image.

Craig

Post Reply