You don't say what version of Director you are using. The following will 
only work if you are using D8. If you are using 7 then you should use what 
Colin provided.

You can d/l a quick demo movie with this behavior from
http://www.brouhahapost.com/dl/to_ImageSwap.zip

The behavior below uses a timeOut object.
WARNING: Email lingo follows. Watch for line breaks.

-- PROPS --
property pMySprite

property pMemToSwapList -- list of memberNums to swap
property pCurrentMem -- current member visible
property pTotalMems -- total number of members in pMemToSwapList

-- Timer Props
property pInterval -- time between events
property pHandler -- handler/method to run each pInterval
--------------------
--------------------

on beginSprite me
   pMySprite = sprite(me.spriteNUm)

   pInterval = pInterval * 1000 -- converts to milliseconds

   -- makes sure a list was passed
   pMemToSwapList = pMemToSwapList.value
   if NOT(listP(pMemToSwapList)) then
     alert "Please enter a list of memberNums to use"
   end if

   pTotalMems = pMemToSwapList.count

   -- inits the timeOut object
   timeOut("flipImage").new(pInterval, pHandler, me)
end beginSprite

--------------------
--------------------

on mFlipImage me

   x = 0
   repeat while NOT(x)

     tempVar = pMemToSwapList[random(pTotalMems)]
     if tempVar <> pCurrentMem then
       pCurrentMem = tempVar
       x = 1
     end if

   end repeat

   pMySprite.member = member(pCurrentMem)

end mFlipImage

--------------------
--------------------

on mTest me
   beep

end mTest

--------------------
--------------------

on getPropertyDescriptionList me
   -- You can add or remove any value in this list.
   -- If you add one make sure to add the handler
   -- in the behavior above
   handlerList = [#mFlipImage, #mTest]

   GPDL = [:]
   -- Member Prop
   GPDL[#pMemToSwapList] = [#comment: "Swap from this list (MemberNums):", 
#format: #string, #default: "[]"]

   -- Timer Props
   GPDL[#pInterval] = [#comment: "Timer interval in seconds:", #format: 
#integer, #default: 1]
   GPDL[#pHandler] = [#comment: "Handler to execute:", #format: #symbol, 
#default: "", #range: handlerList]

   return GPDL
end getPropertyDescriptionList

This behavior doesn't account for the possibility of multiple casts, but I 
gotta leave something for you to figure out right. ;)

Hope this get's you going.
Later.
...Neil




[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!]

Reply via email to