This should be very helpful for you (it’s one of the better structured document pages)
http://docs.coronalabs.com/api/type/Event.html
-Saer
This should be very helpful for you (it’s one of the better structured document pages)
http://docs.coronalabs.com/api/type/Event.html
-Saer
Does something like this work?
[lua]
local pennyChannel = 0
local function play()
if ( pennyChannel ) then
if not ( audio.isChannelPlaying( pennyChannel ) ) then
pennyChannel = audio.play( pennySong )
end
end
end
[/lua]
Thanks Saer…
I read that before, about a month ago.
I read that today 2 times, really slow, an trying to understand what to do…
–Like this line “Hit events propagate until they are handled. You can stop propagation to the next object (all listeners of the current object still get the event) by telling the system that the event was handled.”
– by telling the system that the event was handled. – yes… but how?
or this one “This is very difficult to achieve using the default dispatch behavior and propagation rules of hit events.”
– I know it’s very difficult, that is why I do need help
why they don’t actually put
– sample code in a simple app
– or pictures
– or better yet, a little video, with real life examples
–in plain English words, not computer terms
do they do it like that to make it on purpose difficult,
so only a very few privileged ones can actually make nice apps?
or they make it difficult, because that is the way they learned,
after a lot of time, and they know no other way to teach?
or they just don’t have time and money to add videos
graphics, pictures, sample code, and all that to their web-site?
Just look on top of this post…
how many post, back and forth…
and still I can’t do it.
I think it’s me, I just want to do something that I am not prepared for, yet!
I guess I’m asking too much, to actually see a piece of code.
I just wish I could see the code to actually learn and study it.
----like the code piotrz55. made for me, on physics
when I was trying to learn collision
he gave me this – if event.other.name == “crate” then
where I had to write the “name” of the object
and of course the – event.other.name
without those few lines in an actual little app
I would probably still be looking for the answer today.
I will keep looking, studying and waiting for the code…
I hope someone will be so kind, to gave me that piece of information
(my birthday is on October 8th – I’ll be 53)
In your code replace this:
[lua]
local function play ()
numTaps = numTaps + 1
if numTaps == 1 then
songIsPlaying = true
songIsPlaying = audio.play(pennySong)
numTaps = numTaps + 1
elseif numTaps > 1 then
print(“no song”)
numTaps = 0
end
end [/lua]
With this:
[lua]
local pennyChannel = 0
local function play()
if ( pennyChannel ) then
if not ( audio.isChannelPlaying( pennyChannel ) ) then
pennyChannel = audio.play( pennySong )
end
end
end
[/lua]
And see if it helps at all.
‘Sample code with sample app’
I do not know of you are aware but with Corona you install a lot of sample apps with sample code. When you open corona simulator then there is always window with black background and few buttons. Under one of them (if you click it) there is bunch of samples divided into tematic sections you can browse to learn.
‘Little videos’
There is a lot of videos on internet. On youtube CoronaLabs has even it’s own training videos.
‘Make it difficult…, make it on purpose…’
I think you are wrong here. They nowhere make things difficult on purpose, no one does - for what purpose they would?
Things are written straightly and in minimalistic yet essential form. However, it’s hard not to write about things without using terminology associated with them. These are english words for sure (think that people around the world must know english to get access to documentations and the bigger sources of knowledge). If you talk about music you also use music terms and there is nothing wrong with it - one cannot blame this terms because he cannot comprehend them. You just have to somehow get your head around it and slowly learn.
If you would like to have everything in documentation written with smallest details and explained throughly then there is no sense, meaning that you always have to assume that people have some knowledge or will slowly get it. I have nowhere seen documentation written more then essential. It’s aim of samples and tutorials to explain things more.
@piorz55 - I agree.
In reference to this “This is very difficult to achieve using the
default dispatch behavior and propagation rules of hit events.”
They
are not referring to the entire process of creating an event. Notice
they are talking about " Overriding Propagation with focus" and how
using the default method would be difficult.
If you don’t know what ‘Propagation’ is then google it 
“in plain English words, not computer terms.” This is programming, therefore there will be program specific terms. That’s why the docs are there, to demonstrate and explain how to apply them.
lol As a jazz pianist, I’ve had friends tell me the same thing - “Why not just speak English?!”
diatonic scale, deceptive cadence, glissando etc… Everything takes time to learn, music theory being an excellent example.
“do they do it like that to make it on purpose difficult, so only a very few privileged ones can actually make nice apps?”
lol no. Lua is a very beginner friendly language. 
The people you refer to as “privileged” are creating “nice apps” because they took the time needed to learn all this so they know how to apply it to their own app/s. They did not limit themselves by thinking only certain people are able to learn this.
I never had people giving me all the answers&code whenever I had a problem, that’s not to say I haven’t used the forums of course I have.
However, because I took the time to learn the inner-workings and mechanics behind the code I am now able to create my own mildly complex functions and understand how to manipulate other code I find, to suit my own needs.
Am I an expert? HAha not even remotely. I’m still a newb when it comes to all this. 
As far as getting the code from piotrz55, event.other.name
If you read the docs you’d understand what ’ event’ ’ other’ and ’ name’ are referring to and therefore would’ve been able to do it yourself.
Like I’ve said before, it’s one thing to paste in event.other.name and see the result, but it’s another thing to understand why you’re using that syntax.
I can almost guarantee piotrz55 did not magically know what that syntax means and how to use it.
He, as well as most other people, took the time to learn what it all means.
Also, “or they just don’t have time and money to add videos graphics, pictures, sample code, and all that to their web-site?”
I very highly doubt it. They aren’t any shortcuts when it comes to learning programming.
The majority of their docs are organized well and easy to understand if you take the time.
* While lua is an easy language to learn with, there are basic/fundamental concepts that are universal across all programming. It’d be good to learn them. 
ANYWAYS, it seems develephant is willing to jut give you the code, with that said I end my “speech/rant”.
Btw, I say all this to motivate you Not get ya down. 
-Saer
Edit: My all time favorite quote is "The only limits in life are those we set ourselves. "

Events are a higher level bit of programming. They are so simplistic that they come off complicated, and really don’t make much sense until you “get it” in my opinion.
I’ve been programming for over 20+ years. I’ve also taught quite a few classes, and I know a lot of developers frown upon giving out code. But it’s been my experience that sometimes just getting over certain bumps in the road can be very energizing. When a person is frustrated, it’s hard to problem solve. I can see that he is obviously bright enough to get to where he is now. In my opinion, giving a tiny piece to the bigger picture is not going to spoil his learning experience.
Cheers.
Thank you develephant. I just need a little bit.
it works!!! really good!!!
But you know what…
Yesterday, my brother came from Mexico, to visit me for my Birthday.
I have not seem him in long time(for personal reasons)
he is en Engineer an a Programmer, he’s been programming for
over 25 years, he is really good at that.
I show him what I was doing…it’s like Mary had a little lamb for him, like kindergarten.
He makes huge programs for companies.
He told me the same things you are talking about. an I understand you now a little bit better.
I just want to do things faster.
I study music for 10 years, and I have been in music for 30, so I do know music really well.
I just need time(but sense I’m 53) I don’t know how much time left I have.
that is not your fault.
I’m going to keep reading, and learning, and making apps.
anyway, I had a problem for 6 months in an app
I told the problem to my brother, and in 20 minutes
he wrote a function and told me how to do it.
like nothing, simple for him.
he mention a lot of “passing” something to a function
or the “return” this or that
terms I just don’t get it well, but he help me to try to understand that.
I understand you better, much better now, thanks for everything
you have help me a lot. and I know what I know thanks to you…
i know this post is kind of old now but if you could, could you please post that function that helped you with this problem?
im having a simpilar problem myself, thanks
HELP ASAP thankyou
my problem is more related to preventing a button from being tapped until a certain point in a transition (which is triggereed by tapping that button) is reached after which the button can be pressed again but only once until the transition of the image is complete
(the first half of the transition is at from “leftEyeMovement = 1” to the end of the ‘first’ “leftEyeMovement = 3” code ‘bulk’ (i dont know how else to explain that bit)
here is the annoying part of my code; help ASAP:
leftEyeMovement = 1 local function event3(event) if leftEyeMovement == 1 then local function finishMove1() leftEyeMovement = 2 end leftEyeMovement = 3 button:setEnabled( false ) button2:setEnabled( false ) button3:setEnabled( false ) transition.to(eye2, {time = 1000, x=30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(leftEyeCover, {time = 2000, x = 325, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(leftEyeCover, {time = 2000, delay = 3000, x = 500, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(eye2, {time = 1000, delay = 3000, x=-30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(eye, {time = 1000, delay = 3000, x=30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(leftEyeCover, {time = 2000, delay = 6000, x = -500, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(eye2, {time = 1000, delay = 6000, x=30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(eye, {time = 1000, delay = 6000, x=-30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) button3:setLabel( "Please Press To Alternate Again" ) button3:setEnabled( true ) end if leftEyeMovement == 2 then local function finishMove2() leftEyeMovement = 1 button:setEnabled( true ) button2:setEnabled( true ) end leftEyeMovement = 3 transition.to(leftEyeCover, {time = 2000, x = 500, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) transition.to(eye2, {time = 1000, x=-30, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) transition.to(eye, {time = 1000, x=30, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) transition.to(leftEyeCover, {time = 2000, delay = 2000, x = -825, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) transition.to(eye, {time = 1000, delay = 2000, x=-30, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) button3:setLabel( "Alternate Test" ) end end button3 = widget.newButton{ label = "Alternating Test", fontSize = 30, width = 640, height = 90, left = 0, top = 750, onPress=event3 }
if anyone would be kind enough to modify my code for me it would be huge help!
I NEED TO FINISH THE APP BY TOMORROW!!! 
please and thankyou
HELP NEEDED BEFORE 10PM GMT PLEASE
To expand: i am wanting to prevent the user from double tapping at certain points in the transition as at these points if the user keeps tapping the object that it transitioning keeps moving further and further away the more the user presses the button
this is a real pain in the backside
ive got no time for ‘reading around the topic’ at this point, ive been making this app for months and ive tried to use many ways to counter these issues but i cant understand it
See if this helps:
[lua]
leftEyeMovement = 1
local function event3(event)
if event.phase == “ended” then
if leftEyeMovement == 1 then
local function finishMove1()
leftEyeMovement = 2
end
leftEyeMovement = 3
button:setEnabled(false)
button2:setEnabled(false)
button3:setEnabled(false)
transition.to(eye2, { time = 1000, x = 30, delta = true, transition = easing.outQuad })
transition.to(leftEyeCover, { time = 2000, x = 325, delta = true, transition = easing.outQuad, onComplete = finishMove1 })
transition.to(leftEyeCover, { time = 2000, delay = 3000, x = 500, delta = true, transition = easing.outQuad })
transition.to(eye2, { time = 1000, delay = 3000, x = -30, delta = true, transition = easing.outQuad })
transition.to(eye, { time = 1000, delay = 3000, x = 30, delta = true, transition = easing.outQuad })
transition.to(leftEyeCover, { time = 2000, delay = 6000, x = -500, delta = true, transition = easing.outQuad })
transition.to(eye2, { time = 1000, delay = 6000, x = 30, delta = true, transition = easing.outQuad })
transition.to(eye, { time = 1000, delay = 6000, x = -30, delta = true, transition = easing.outQuad })
button3:setLabel(“Please Press To Alternate Again”)
button3:setEnabled(true)
end
if leftEyeMovement == 2 then
local function finishMove2()
leftEyeMovement = 1
button:setEnabled(true)
button2:setEnabled(true)
end
leftEyeMovement = 3
transition.to(leftEyeCover, { time = 2000, x = 500, delta = true, transition = easing.outQuad, onComplete = finishMove2 })
transition.to(eye2, { time = 1000, x = -30, delta = true, transition = easing.outQuad })
transition.to(eye, { time = 1000, x = 30, delta = true, transition = easing.outQuad })
transition.to(leftEyeCover, { time = 2000, delay = 2000, x = -825, delta = true, transition = easing.outQuad })
transition.to(eye, { time = 1000, delay = 2000, x = -30, delta = true, transition = easing.outQuad })
button3:setLabel(“Alternate Test”)
end
end
end
button3 = widget.newButton{
label = “Alternating Test”,
fontSize = 30,
width = 640,
height = 90,
left = 0,
top = 750,
onPress = event3
}
[/lua]
thanks alot for the reply
i tried the above and the button stopped working al together
however your code above made me notice something that solved my problem:
where i have written ‘onComplete = finisMove1’ and ‘onComplete = finishMove2’ in the transition.to code
i realised that by simply placing the onComplete function onto the last transition.to code of each half of the transition i was able to solve my problem.
i’ll post the code for anyone that will need it in the future
and again i thankyou alot for the help, even if it was an indirect eye opener 
leftEyeMovement = 1 local function event3(event) if leftEyeMovement == 1 then local function finishMove1() leftEyeMovement = 2 end leftEyeMovement = 3 button:setEnabled(false) button2:setEnabled(false) transition.to(eye2, { time = 1000, x = 30, delta = true, transition = easing.outQuad }) transition.to(leftEyeCover, { time = 1000, x = 325, delta = true, transition = easing.outQuad }) transition.to(leftEyeCover, { time = 1000, delay = 2000, x = 500, delta = true, transition = easing.outQuad }) transition.to(eye2, { time = 1000, delay = 2000, x = -30, delta = true, transition = easing.outQuad }) transition.to(eye, { time = 1000, delay = 2000, x = 30, delta = true, transition = easing.outQuad }) transition.to(leftEyeCover, { time = 1000, delay = 4000, x = -500, delta = true, transition = easing.outQuad }) transition.to(eye2, { time = 1000, delay = 4000, x = 30, delta = true, transition = easing.outQuad }) transition.to(eye, { time = 1000, delay = 4000, x = -30, delta = true, transition = easing.outQuad }) transition.to(leftEyeCover, { time = 1000, delay = 6000, x = 500, delta = true, transition = easing.outQuad }) transition.to(eye2, { time = 1000, x = -30,delay = 6000, delta = true, transition = easing.outQuad }) transition.to(eye, { time = 1000, x = 30,delay = 6000, delta = true, transition = easing.outQuad, onComplete = finishMove1 }) button3:setLabel("Please Press To Reset") end if leftEyeMovement == 2 then local function finishMove2() leftEyeMovement = 1 end leftEyeMovement = 3 transition.to(leftEyeCover, { time = 1000, x = -825, delta = true, transition = easing.outQuad }) transition.to(eye, { time = 1000, x = -30, delta = true, transition = easing.outQuad, onComplete = finishMove2 }) button3:setLabel("Alternate Test") end end button3 = widget.newButton{ label = "Alternating Test", fontSize = 30, width = 640, height = 90, left = 0, top = 750, onPress = event3 }
i know this post is kind of old now but if you could, could you please post that function that helped you with this problem?
im having a simpilar problem myself, thanks
HELP ASAP thankyou
my problem is more related to preventing a button from being tapped until a certain point in a transition (which is triggereed by tapping that button) is reached after which the button can be pressed again but only once until the transition of the image is complete
(the first half of the transition is at from “leftEyeMovement = 1” to the end of the ‘first’ “leftEyeMovement = 3” code ‘bulk’ (i dont know how else to explain that bit)
here is the annoying part of my code; help ASAP:
leftEyeMovement = 1 local function event3(event) if leftEyeMovement == 1 then local function finishMove1() leftEyeMovement = 2 end leftEyeMovement = 3 button:setEnabled( false ) button2:setEnabled( false ) button3:setEnabled( false ) transition.to(eye2, {time = 1000, x=30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(leftEyeCover, {time = 2000, x = 325, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(leftEyeCover, {time = 2000, delay = 3000, x = 500, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(eye2, {time = 1000, delay = 3000, x=-30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(eye, {time = 1000, delay = 3000, x=30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(leftEyeCover, {time = 2000, delay = 6000, x = -500, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(eye2, {time = 1000, delay = 6000, x=30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) transition.to(eye, {time = 1000, delay = 6000, x=-30, delta=true, transition=easing.outQuad, onComplete=finishMove1 }) button3:setLabel( "Please Press To Alternate Again" ) button3:setEnabled( true ) end if leftEyeMovement == 2 then local function finishMove2() leftEyeMovement = 1 button:setEnabled( true ) button2:setEnabled( true ) end leftEyeMovement = 3 transition.to(leftEyeCover, {time = 2000, x = 500, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) transition.to(eye2, {time = 1000, x=-30, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) transition.to(eye, {time = 1000, x=30, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) transition.to(leftEyeCover, {time = 2000, delay = 2000, x = -825, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) transition.to(eye, {time = 1000, delay = 2000, x=-30, delta=true, transition=easing.outQuad, onComplete=finishMove2 }) button3:setLabel( "Alternate Test" ) end end button3 = widget.newButton{ label = "Alternating Test", fontSize = 30, width = 640, height = 90, left = 0, top = 750, onPress=event3 }
if anyone would be kind enough to modify my code for me it would be huge help!
I NEED TO FINISH THE APP BY TOMORROW!!! 
please and thankyou
HELP NEEDED BEFORE 10PM GMT PLEASE
To expand: i am wanting to prevent the user from double tapping at certain points in the transition as at these points if the user keeps tapping the object that it transitioning keeps moving further and further away the more the user presses the button
this is a real pain in the backside
ive got no time for ‘reading around the topic’ at this point, ive been making this app for months and ive tried to use many ways to counter these issues but i cant understand it
See if this helps:
[lua]
leftEyeMovement = 1
local function event3(event)
if event.phase == “ended” then
if leftEyeMovement == 1 then
local function finishMove1()
leftEyeMovement = 2
end
leftEyeMovement = 3
button:setEnabled(false)
button2:setEnabled(false)
button3:setEnabled(false)
transition.to(eye2, { time = 1000, x = 30, delta = true, transition = easing.outQuad })
transition.to(leftEyeCover, { time = 2000, x = 325, delta = true, transition = easing.outQuad, onComplete = finishMove1 })
transition.to(leftEyeCover, { time = 2000, delay = 3000, x = 500, delta = true, transition = easing.outQuad })
transition.to(eye2, { time = 1000, delay = 3000, x = -30, delta = true, transition = easing.outQuad })
transition.to(eye, { time = 1000, delay = 3000, x = 30, delta = true, transition = easing.outQuad })
transition.to(leftEyeCover, { time = 2000, delay = 6000, x = -500, delta = true, transition = easing.outQuad })
transition.to(eye2, { time = 1000, delay = 6000, x = 30, delta = true, transition = easing.outQuad })
transition.to(eye, { time = 1000, delay = 6000, x = -30, delta = true, transition = easing.outQuad })
button3:setLabel(“Please Press To Alternate Again”)
button3:setEnabled(true)
end
if leftEyeMovement == 2 then
local function finishMove2()
leftEyeMovement = 1
button:setEnabled(true)
button2:setEnabled(true)
end
leftEyeMovement = 3
transition.to(leftEyeCover, { time = 2000, x = 500, delta = true, transition = easing.outQuad, onComplete = finishMove2 })
transition.to(eye2, { time = 1000, x = -30, delta = true, transition = easing.outQuad })
transition.to(eye, { time = 1000, x = 30, delta = true, transition = easing.outQuad })
transition.to(leftEyeCover, { time = 2000, delay = 2000, x = -825, delta = true, transition = easing.outQuad })
transition.to(eye, { time = 1000, delay = 2000, x = -30, delta = true, transition = easing.outQuad })
button3:setLabel(“Alternate Test”)
end
end
end
button3 = widget.newButton{
label = “Alternating Test”,
fontSize = 30,
width = 640,
height = 90,
left = 0,
top = 750,
onPress = event3
}
[/lua]