Ok este es para tu Boton de Play y Pause (SONIDO)
----------------------------------------------------------------------
-- Property declarations --
property soundChannel -- number of, then pointer to, sound channel
property soundMember -- member to play in soundChannel
property startPlaying -- TRUE if sound is to start playing immediately
property pSprite -- sprite this behavior is attached to
property pOffMember -- member to show while sound is paused
property pOnMember -- member to show while sound is playing
property pCurrentTime -- integer .currentTime of sound when paused
property pLoopState -- remembers value of soundMember.loop so that
-- It can be reset on endSprite
?
?
?
-- EVENT HANDLERS --
On beginSprite(me) ---------------------------------------------------
-- ACTION Initializes the behavior
--------------------------------------------------------------------
pSprite = sprite(me.spriteNum)
-- Button members
pOffMember = pSprite.member
pOnMember = member(pOffMember.number + 1) -- next cast slot
soundChannel = sound(soundChannel)
pCurrentTime = 0
-- Switch off .loop property of soundMember if it is on, but
-- remember to switch it back on on endSprite. If this is not
-- done, soundChannel.play() will start from the beginning,
-- regardless of the #startTime value that is used.
pLoopState = soundMember.loop
soundMember.loop = 0
-- Start playing the sound, if required
if startPlaying then
me.mouseUp()
end if
end beginSprite
?
?
on endSprite(me) -----------------------------------------------------
-- ACTION Ensures that the .loop property of soundMember is set
-- back to TRUE if
soundMember.loop = pLoopState
end endSprite
?
?
On mouseEnter(me) ----------------------------------------------------
-- ACTION Shows the finger cursor over this sprite
--------------------------------------------------------------------
Cursor 280
end mouseEnter
?
?
On mouseLeave(me) ----------------------------------------------------
-- ACTION Returns control of the cursor to the system
--------------------------------------------------------------------
Cursor 0
end mouseLeave
?
?
On mouseUp(me) -------------------------------------------------------
-- ACTION Plays or pauses the sound, and shows the appropriate
-- Member
--------------------------------------------------------------------
if soundChannel.status = 3 then
-- The sound is playing pause it
pCurrentTime = soundChannel.currentTime
soundChannel.pause()
vMember = pOffMember
else
-- The sound is not playing, (re-)start it
vSoundList = []
vSoundList[#member] = soundMember
vSoundList[#startTime] = pCurrentTime
soundChannel.play(vSoundList)
vMember = pOnMember
end if
pSprite.member = vMember
end mouseUp
?
?
on enterFrame(me)
if pSprite.member = pOnMember then
if not soundChannel.status then
-- The piece has finished playing
pSprite.member = pOffMember
pCurrentTime = 0
end if
end if
end enterFrame
?
?
?
-- Behavior parameters --
On getPropertyDescriptionList(me)
vPropertyList = []
vPropertyList[ \
#soundChannel] = [ \
#comment "Sound channel", \
#format #integer, \
#default 1, \
#range [1, 2, 3, 4, 5, 6, 7, 8]]
vPropertyList[ \
#soundMember] = [ \
#comment "Sound member", \
#format #sound, \
#default member(1)]
vPropertyList[ \
#startPlaying] = [ \
#comment "Start playing sound immediately?", \
#format #boolean, \
#default FALSE]
return vPropertyList
end getPropertyDescriptionList
-------------------------------------------------------------------------------------------------
www.videoarteproducciones.comhttp://www.youtube.com/user/tvsoto