My first app

The idea behind my first app is that you press a button, and it makes noise. Heres the code I have. For some reason, it does everything but play the sound…

display.setStatusBar(display.HiddenStatusBar)
local button = display.newImage( “Circle.png” )
button.x = display.contentWidth / 2
button.y = display.contentHeight - 50

function button:tap( event )
media.playEventSound( “beep.caf” )
end

button:addEventListener( “tap”, button ) [import]uid: 27919 topic_id: 8393 reply_id: 308393[/import]

Did you try putting a print statement inside the tap function to make sure it is being called? Glancing at your code that looks fine, so I always start by double-checking the simple stuff. [import]uid: 12108 topic_id: 8393 reply_id: 30026[/import]

Sorry, not helpful. [import]uid: 27919 topic_id: 8393 reply_id: 30043[/import]

um, could you be more specific than that? Like, what wasn’t helpful, and why? [import]uid: 12108 topic_id: 8393 reply_id: 30055[/import]

" Sorry, not helpful. "

lol I just had to post and say that actually made me laugh. [import]uid: 30314 topic_id: 8393 reply_id: 30135[/import]

Well, I have triple checked every single line of code, and I just don’t understand why this wouldn’t work…

Isn’t this supposed to be easy to learn? :slight_smile: [import]uid: 27919 topic_id: 8393 reply_id: 30257[/import]

Not sure why its not working for you, but i know that for a “short” sound you should load the sound effect, and then can play it back as shown below:

  
--This loads your sound into a variable so its ready to be used:  
local beepSound = media.newEventSound( "beep.caf" )  
  
--You then can use this when you want to playback your sound  
media.playEventSound( beepSound )  
  

EDIT: i just realized that you have not loaded your sound like at the start of my code, i bet thats your problem [import]uid: 19620 topic_id: 8393 reply_id: 30262[/import]

i think he meant he tried and it didn’t help. he wasn’t calling you unhelpful :slight_smile:
[import]uid: 6645 topic_id: 8393 reply_id: 30282[/import]

I had no idea what he meant, I didn’t assume anything. That’s why I asked for clarification.

@bittersweet: You still haven’t answered any of my questions. I’m not sure how you expect anyone to help you when you ignore everything we say. [import]uid: 12108 topic_id: 8393 reply_id: 30300[/import]

jmp, and jhocking are some of the most helpful people ive seen on these forums. you may want to apologize to them =) Anyways best of luck chum. [import]uid: 19620 topic_id: 8393 reply_id: 30307[/import]