Boton play y pause con lingo

Hola experto, como puedo hacer un boton en codigo lingo que me haga el pause y play en un solo boton en director, estoy como loco buscando la respuesta y no logro encontrar la forma. Muchas gracias.

1 respuesta

Respuesta
1
On keyDown me
s = sprite (me.spriteNum)
if the key = "p" then
s.pPaused = not s.pPaused
if s.pPaused = 0 then (lo que quieras)
if s.pPaused = 1 then (lo que quieras)
Espero que sea lo que buscas, Buena Suerte.
http://www.youtube.com/user/tvsoto
Gracias por tu respuesta, pero no entiendo muy bien lo que me pones, podrias explicarme un poco mejor este codigo por favor. recuerda que lo que necesito es un boton que haga pause a un sonido y que luego al darle otro click vuelva a sonar.
muchas gracias otra vez
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.com
http://www.youtube.com/user/tvsoto
Muchas gracias por tu tiempo experto, no me quedo muy claro ya que soy novato en esto y el codigo es muy largo y complicado. pero muchas gracias de todas maneras.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas