Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
how load and play sound with js? |
||||
|
there is a ccbPlaySound and ccbStopSound command you can read more about it in CC docs |
||||
|
wrote: there is a ccbPlaySound and ccbStopSound command you can read more about it in CC docs man, i'm dumb but not stupid...there nothing more in documentation, i cant play sound ccbPlaySound(filename) i use name file like "data/sound/somesound.wav" and nothing is happen no sound, no debug console message, nothing. what i do wrong?? |
||||
|
just trying to help .. i dont know why it does not play maybe the path is wrong |
||||
|
uhh... Try using backslashes? "data\sound\somesound.wav" But that might be stupid, not dumb. |
||||
|
This works: ccbPlaySound("Content\\ding.wav"); This works: ccbPlaySound("Content/ding.wav"); This works: var path = "Content\\ding.wav"; ccbPlaySound(path); This works: var path = "Content/ding.wav"; ccbPlaySound(path); All depends on how you want to do it. Backslashes are more readable. |
||||
|
you not dumb you really stupid, don't use ccbPlaySound function just create sound in cc and change property like "Volume" to 0 if you need stop sound or 100 if sound be played |
||||
|
samgrady it was helpful, so i use two function now: function playSound(name){ ccbSetSceneNodeProperty(ccbGetSceneNodeFromName(name),"PlayMode","nothing"); ccbSetSceneNodeProperty(ccbGetSceneNodeFromName(name),"PlayMode","play_once"); } function stopSound(name){ ccbSetSceneNodeProperty(ccbGetSceneNodeFromName(name),"PlayMode","nothing"); } |
|