Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Toggle ButtonsEnabled Property of a Flash Member
Acrobat Reader
Irregular MIAW
Xtra Checker
Turn puppeting on for a range of sprite channels
Check QuickTime Version
Password Field
Buddy Saver
Device Xtra
Tree View
MediaMacros Xtras Mall
 

 

 

Behavior Sound Play/Stop

Added on 5/14/2000

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC Shockwave

Rating:

Author: MarkBoyd (website)

When dropped on a graphic sprite this behavior will allow you to choose a sound member to play (via puppetSound) and select 4 button states: Play up, Play down, Stop Up, and Stop down. You can then choose which sound channel to use. It will "remember" the proper state the button should be in when you return to this frame. It will also revert back to the Play button when the music stops.

-- by Mark A. Boyd
-- http://www.mboyd.com/
-- 16-May-2000 - Removed all (hopefully) remaining dot syntax
-- 13-May-2000 - placed in the public domain

property spriteNum, mySprite
property pPlayMem -- Play button member
property pPlayDownMem -- optional down state
property pStopMem -- Stop button member
property pStopDownMem -- optional down state
property pMusicMem -- sound or music to play
property pSoundChannel -- sound channel
property pPlayState -- toggle flag

on beginSprite me
   set mySprite = sprite(spriteNum)
   set pPlayState = soundBusy(pSoundChannel)
   mSwapMyMem
end

on mouseDown me
   if pPlayState then
     set the member of sprite mySprite = pPlayDownMem
   else
     set the member of sprite mySprite = pStopDownMem
   end if
end

on mouseUp me
   set pPlayState = NOT pPlayState
   if pPlayState = 1 then
     -- start playing
     puppetSound(pSoundChannel,pMusicMem)
   else
     -- stop playing
     puppetSound(pSoundChannel,pPlayState)
   end if
   mSwapMyMem
end

on mouseLeave me
   mSwapMyMem
end

on mouseUpOutSide me
   mSwapMyMem
end

on prepareFrame me
   -- swap members only if the sound has changed states
   -- ie: The music stopped
   if pPlayState <> soundBusy(pSoundChannel) then
     set pPlayState = soundBusy(pSoundChannel)
     mSwapMyMem
   end if
end

on mSwapMyMem me
   if pPlayState then
     -- music playing. Set member to stop member
     set the member of sprite mySprite = pStopMem
   else
     -- music stopped. Set member to play member
     set the member of mySprite = pPlayMem
   end if
end

on getPropertyDescriptionList me
   if the currentSpriteNum = 0 then exit
   set myMem = the member of sprite (the currentSpriteNum)
   set theNum = (the memberNum of myMem) + 1
   set theLib = the castLibNum of member myMem
   set defPlayDown =  member theNum of castLib theLib
   set theNum = theNum + 1
   set defStopMem =  member theNum of castLib theLib
   set theNum = theNum + 1
   set defStopDown =  member theNum of castLib theLib
   set pList = [:]

   addProp(pList,#pPlayMem,[¬
   #comment:"Play button:",¬
   #format:#bitmap,¬
   #default:myMem])

   addProp(pList,#pPlayDownMem,[¬
   #comment:"Play button down:",¬
   #format:#bitmap,¬
   #default:defPlayDown])

   addProp(pList,#pStopMem,[¬
   #comment:"Stop button:",¬
   #format:#bitmap,¬
   #default:member(defStopMem)])

   addProp(pList,#pStopDownMem,[¬
   #comment:"Stop button down:",¬
   #format:#bitmap,¬
   #default:member(defStopDown)])

   addProp(pList,#pMusicMem,[¬
   #comment:"Sound to play:",¬
   #format:#sound,¬
   #default:1])

   addProp(pList,#pSoundChannel,[¬
   #comment:"Sound Channel:",¬
   #format:#integer,¬
   #default:1,¬
   #range:[#min:1,#max:8]])

   return pList
end

on getBehaviorDescription me
   return "When dropped on a graphic sprite this behavior will allow you to choose a sound member to play (via puppetSound) and select 4 button states: Play up, Play down, Stop Up, and Stop down. You can then choose which sound channel to use." &return &return &"It will " "e &"remember" "e &&"the proper state the button should be in when you return to this frame." &return &return &"It will also revert back to the Play button when the music stops."
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail