led lighting sequentially on button click

i'm still learning arduino. I'm trying to initialize a sequence of 3 leds lighting sequentially on button click. What I want is that the button acts as a switch switching on and off the sequence. So far I've done it but you have to keep the button pressed to keep it running.. I've tried another method by reading the button state after the sequence(all 3 leds) has finished, but I'm still not satisfied with that solution, since I want to be able to press the button switch ANY time during the sequence to turn the sequence off. Any help please? current code is below:

if(new_btn_state3 != old_btn_state3 && new_btn_state3 == HIGH){
test= true;
}
if(test){
analogWrite(LED10, 255);
digitalWrite(LED10, HIGH);
delay(100);
digitalWrite(LED10, LOW);
digitalWrite(LED12, HIGH);
delay(100);
digitalWrite(LED12, LOW);
digitalWrite(LED13, HIGH);
delay(100);
digitalWrite(LED13, LOW);
delay(50);
}

test is just a boolean i was testing with..
I think that to achieve what I really want I must use some type of multi-threading maybe? I don't know.. want to hear from u guys first..

First off always use code tags when posting code and always post all your code.

Yes you need to use the blink without delay technique. That involves using the millis() timer and doing things at the right time. You need to remove all delays.
See
http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html

Or / and Robin2's several things at once
http://forum.arduino.cc/index.php?topic=223286.0

All right, I will check them out :slight_smile: Thanks a lot and sorry, but that was my first post in here..