At 11:33 AM -0600 11/24/00, M wrote:
>HEY ALL
>
>I have a question. I created a rollover the other day, where my
>castmembers exchange one after the other(from 1 to 50). On mouseenter, they
>exchange forward 1 to 50. On mouseleave, they exchange backwards, 50 to 1.
>I had them working with a delay, so that each castmember could be seen.
>The script I made was used on a frame. Everything worked great, but today I
>can't seem to make it work.
>Can someone tell me where to put the delay; or better yet can someone tell
>me how to create a rollover, that exchanges some 50 castmembers, where
>every castmember can be seen, without the rollover racing, so you only see
>a few castmembers.
>
M,
There are two ways to do it, frame based or time based. Frame based
will update based on your current frame rate. Here is a sample
behavior (untested):
property spriteNum
property pnPix -- number of pictures to show
property pCurrentPicOffset
property pBaseMember
property psymState -- #none, #countingUp, #countingDown
on beginSprite me
pBaseMember = the number of the member of sprite(spriteNum)
pnPix = 50 -- could make this a getPropertyDescriptionList param
psymState = #none
pCurrentPicOffset = 0
end
on mouseEnter me
psymState = #countingUp
end
on mouseLeave me
psymState = #countingDown
end
on exitFrame me
case psymState of
#none:
nothing
#countingUp:
pCurrentPicOffset = pCurrentPicOffset + 1
sprite(spriteNum).member = pBaseMember + pCurrentPicOffset
if pCurrentPicOffset = (pnPix - 1)then
psymState = #none
end if
#countingDown:
pCurrentPicOffset = pCurrentPicOffset - 1
sprite(spriteNum).member = pBaseMember + pCurrentPicOffset
if pCurrentPicOffset = 0 then
psymState = #none
end if
end case
end
Then there is the time base aproach. It is similar, but it waits for
a certain amount of time before changing pictures (again untested):
property spriteNum
property pnPix -- number of pictures to show
property pCurrentPicOffset
property pBaseMember
property psymState -- #none, #countingUp, #countingDown
property pnTicksToWait
property pEndTicks
on beginSprite me
pBaseMember = the number of the member of sprite(spriteNum)
pnPix = 50 -- could make this a getPropertyDescriptionList param
psymState = #none
pCurrentPicOffset = 0
pnTicksToWait = 15 -- wait for a quarter of a second, ajust to
whatever you want.
-- could make this a
getPropertyDescriptionList param also
end
on mouseEnter me
psymState = #countingUp
pEndTicks = the ticks + pnTicksToWait
end
on mouseLeave me
psymState = #countingDown
pEndTicks = the ticks + pnTicksToWait
end
on exitFrame me
case psymState of
#none:
#countingUp:
if the ticks < pEndTicks then
return
end if
pEndTicks = the ticks + pnTicksToWait -- set up for next time
pCurrentPicOffset = pCurrentPicOffset + 1
sprite(spriteNum).member.number = pBaseMember + pCurrentPicOffset
if pCurrentPicOffset = pnPix then
psymState = #none
end if
#countingDown:
if the ticks < pEndTicks then
return
end if
pEndTicks = the ticks + pnTicksToWait -- set up for next time
pCurrentPicOffset = pCurrentPicOffset - 1
sprite(spriteNum).member.number = pBaseMember + pCurrentPicOffset
if pCurrentPicOffset = 0 then
psymState = #none
end if
end case
end
Good luck,
Irv
--
Lingo / Director / Shockwave development for all occasions.
(Over two millions lines of Lingo code served!)
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]