Copy link to clipboard
Copied
My problem is that I can't seem to reset the countReg var back to 0 once it hits 8. any ideas?
var countReg:Number = 0;
function nextReg(event:MouseEvent) : void
{
if (countReg == 9)
{
(countReg == 0);
}
countReg++;
trace (countReg) // it just keeps counting up. won't start over after 8
}
this.next1_btn.addEventListener (MouseEvent.CLICK, nextReg);
THANKS MUCH
function nextReg(event:MouseEvent) : void
{
countReg=(countReg+1)%9
}
Copy link to clipboard
Copied
function nextReg(event:MouseEvent) : void
{
countReg=(countReg+1)%9
}
Copy link to clipboard
Copied
Wow. That's awesome. How about another button that counts backwards untill it gets to 0 and then starts over at 8.
Copy link to clipboard
Copied
use:
var countReg:int=8
function prevReg(event:MouseEvent) : void
{
countReg=(countReg+8)%9
}
p.s. please mark helpful/correct responses.
Copy link to clipboard
Copied
The given solution is nice.And just know where the mistake happen in your code. insed of this "(countReg == 0);" use "countReg = 0". it will work with your own code
Copy link to clipboard
Copied
Thanks!
cid:image001.jpg@01CD7F7A.AA9D8500
Tim Wright | Instructional Designer
[... personal contact info removed ...]