SPi-V: On message play sound
Submitted by k_kwiatek on July 15, 2008 - 18:12.
I have a problem with adding cast members with behaviours to SPi-V in Director.
Have a look to this screen shot.
I can easily add other cast members (like SPi-V: Load panorama) but sth wrong must be with this one (I want to play sound after a silent message from SPi-V).
SPi-V: On message play sound
property pSprite
property pMessage
property pChannel
property pSound
property pTimeout
on beginSprite me
pSprite = sprite(me.spriteNum)
-- subscribe to the specified message
sendSprite(pSprite, #subscribeMessage, pMessage, #spvMessage, me)
end beginSprite
on spvMessage me
if not voidP(pChannel) then
sound(pChannel).fadeIn(500)
sound(pChannel).play()
end if
end spvMessage
on getPropertyDescriptionList
tlSounds = []
repeat with tMemberNum = 1 to the number of members of cast 1
if member(tMemberNum, 1).type = #sound then
tlSounds.add(member(tMemberNum, 1))
end if
end repeat
tlDescription = [:]
tlDescription[#pMessage] = \
[#default: "", \
#format: #string, \
#comment: "Message to listen for:" ]
tlDescription[#pSound] = \
[#default: tlSounds[1], \
#format: #member, \
#range: tlSounds, \
#comment: "Sound to play:" ]
tlDescription[#pChannel] = \
[#default: 1, \
#format: #integer, \
#range: [#min:1, #max:8], \
#comment: "Sound channel:" ]
return tlDescription
end getPropertyDescriptionList
on isOkToAttach me, aSpriteType, aSpriteNum
case aSpriteType of
#graphic:
return sprite(aSpriteNum).member.type = #movie and sprite(aSpriteNum).member.name = "SPi-V.dcr"
-- works for SPi-V sprites only
#script:
return FALSE
-- doesn't work as a frame script
end case
end isOkToAttach
I have also checked my old projects (based on old SPi-V) and I have exactly the same problem. I didn't have problems like this before.
It seems that sth was changed in Director. I have the same Director MX 2004.
Do you what is wrong in the code?
Karol
fieldOfView | SPi-V dev
solved
I used WMA instaed of SWA/WAV and I didn't have music in channel 1 or channel 2.
Sorry for interrupting.
Karol