Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Cannot get sound to play, why?

The following code produces a sound, when an on screen graphical button is pressed.

Why does it work in 1.30 but not in 1.20?

How do I get it to work in 1.20?

Here is the code:

var sound1 = Titanium.Media.createSound({
url:'../sounds/jingle.mp3'
});

var b1 = Titanium.UI.createButton({
color:'#000',
backgroundImage:'../images/b1.png',
top:5,
left:15,
width:130,
height:50,
font:{fontSize:12,fontWeight:'bold',fontFamily:'Helvetica Neue'},
title:'Click for Sound!'
});

win.add(b1);

b1.addEventListener('touchstart', function()
{
sound1.play();
pb.max = sound1.duration;
});

If you can help me, many, many thanks I am having to go back to 1.20 to get my code to build and this is causing me a big headache.

— asked May 21st 2010 by Stephen Page
  • 1.20
  • 1.30
  • playing
  • sound
0 Comments

1 Answer

  • Change the event to click. Maybe this will fix the problem.

    — answered May 22nd 2010 by Dan Tamas
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.