At 4:18 AM -0500 11/22/00, Steven Sacks wrote:
>You can also compact it like so:
>
>MOVIE SCRIPT:
>global myList
>myList = ["ring","boom","clang","beep","boink"]
>
>SPRITE SCRIPT:
>global myList
>on mouseUp me
>   puppetSound 1, myList[random(myList.count())]
>end
>
>This way you're not building the soundlist
>everytime you click on the sprite.
>

Or even more "encapsulated" into the single behavior without the need 
for a global and without regenerating the list every time:

property pSoundList
property pnSounds

on beginSprite me
   pSoundList = ["ring","boom","clang","beep","boink"]
   pnSounds = count(pSoundList)
end

on mouseUp
   randomItemNum = random(pnSounds)
   puppetSound 1, pSoundList[randomItemNum]
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!]

Reply via email to