Looping

how can i actually loop for example frame 10 to frame 50 for a certain number of times after i press a button? i tried using this actionscript but it can actually loop for one time.

on (release) {
gotoAndPlay(46);
for (i=1; i<4; i++) {
}
}

on your button
[AS]
on(release){
gotoAndPlay(10);
i=1;
}
[/AS]
on frame ten
[AS]
i++;
[/AS]
on frame fifty
[AS]
//just say your certain number of times is ten
if (i==11){
stop();
}
[/AS]

hi freddythunder, i had tried putting in the actionscript but for instance if i want to loop the frames for 10 times i need to write:

gotoAndPlay(46);
if (i==10){
stop();
}

but the problem is that on the first time i press on the button it will loop for 10 times but after the first press the number of loop will be increase by one. And in your actionscript there’s no:

gotoAndPlay(46);

i had tried not putting that in but the problem is that it will not loop at all.

Try this:[AS]on(release){
gotoAndPlay(10);
i=1;
}[/AS]on frame 50:
[AS]if (i==10) {
// Do whatever you like
}
else {
i++ ;
gotoAndPlay (10) ;
}[/AS]

loop for example frame 10 to frame 50 for a certain number of times

i need to write:
gotoAndPlay(46);

I used the example 10 to 50, the certain number of times was 10; where would I get 46 from? And yes, mine should be (i==10)_ - typo, sorry…

Ilias’ does the same thing - so whichever works for ya!!(-:

i already tried the latest actionscript that you all had sent me but the problem is that when i press the button the led will not run at all.
i had already attact the previous file. the problem for it is that when SW3 is pressed for the first time, the led will loop for 3 times but after the first pressing, everytime when press it will loop for 4 times.
i already attach the file hope that you can help. thanks

On frame 44, you have a gotoAndPlay(2); action so, the way it’s set up, when you hit the play button, it will loop frames 1-44 forever. It will never reach anything past frame 44. What did you want to do?

There seems to be two seperate things you want to accomplish. The first one where the leds blink from the top to bottom. Then another one (past frame 44) that blinks just the top four. Could you describe what you want done with it?

so sorry that i don’t know that i had added in an extra script on frame 44.

when the play button is being press, the led will run from the top to the bottom repeatingly. only when i pressed the SW3, then the first four led to run turn by turn and loop for three times.

That’s what it is doing for me already. Is there something I’m missing?