At 11:15 PM +0000 12/1/00, Rees, Jonathan wrote:
>I have 3 castmembers called leftgrass 1,leftgrass 2 + leftgrass 3.
>Initialy leftgrass 1 is on the stage and is scrolling down sweetly.
>I am tryinging to get it to rotate through the casts. I believe what
>I have done should work, but something is wrong which I cant figure!
>
>
>property pgrass
>property grass
>
>
>on beginsprite
>
> grass="leftgrass"
> pgrass =1
> sprite(2).member = member(grass&&pgrass)
>end
>
>
>on exitFrame
>
> if the locV of sprite 2 > 1890 then
>
> pgrass=pgrass+1
>
> if pgrass >3 then pgrass =1
>
> -------------grass--------------------
Jonathon,
I don't see anything wrong with this (except you don't show how you
display a new "grass" in your exitframe). But here's an alternative
behavior that rotates through 3 castmembers which must be in
consecutive positions in a castlib. It assumes that the first of the
3 is on stage at the beginning (which is what you are saying, I
think). This uses member numbers and offsets instead of names.
property pMemberBase
property pCurrentOffset
property spriteNum
on beginSprite me
pMemberBase = sprite(spriteNum).member.number
pCurrentOffset = 0
end
on exitframe
if sprite(spriteNum).locV <= 1890 then
return
end if
pCurrentOffset = pCurrentOffset + 1
if pCurrentOffset = 3 then
pCurrentOffset = 0
end if
sprite(spriteNum).member = pMemberBase + pCurrentOffset
end
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!]