PDA

View Full Version : timed image rotation?


Daniel Diroll
08-12-2005, 10:38 AM
I've fallen and I can't get up.

I am working with AMS Prof. v., putting together some exercise guidelines. I would like to have a page open which has four images overlayed upon one another. The goal is to have each image rotate (i.e. Set.Visible) so the four images appear to be a looped video; I want to show clients the general movement of several exercises.

I have attempted to mimic some of the code from previous discussions but have been frustratingly unsuccessful.

Some help would be GREATLY appreciated!

Worm
08-12-2005, 10:53 AM
Rename your image objects so that they have a number representing the sequence they should show

Image1
Image2
Image3
Image4

in the On Preload event of the page, add this code

for n=2, to 4 do -- 4 being the highest numbered picture object
Image.SetVisible("Image"..n, false); --hide all images except the first one
end



in the On Timer event add this code

if Ctr == nil then
Ctr =1;
end

Ctr = Ctr + 1;

if Ctr > 4 then -- 4 being the highest number Image Object
Ctr = 1
end

Image.SetVisible("Image"..Ctr, true)
if Ctr == 1 then
Image.SetVisible("Image"..4, false)
else
Image.SetVisible("Image"..Ctr - 1, false)
end


In the On Show event

Page.StartTimer(3000);

Daniel Diroll
08-12-2005, 11:36 AM
Many Thanks Worm! Works great. One small adjustment was to remove "to" on line one in the On Preload event. Thanks again.

Worm
08-12-2005, 11:41 AM
Sorry, I was typing that off the top of my head. I seem to do that alot with my for loops. For some reason I keep wanting to inject VB code into my Lua code. Sometime they play well together, sometimes they don't :)