Skip to main content
Known Participant
May 13, 2010
Answered

for loop inquiry

  • May 13, 2010
  • 1 reply
  • 608 views

I used the following for loop code below and this caused Flash to freeze and/or crash

for (var i:int = 1; i <= 30; i + 5)

{

     trace(i);
}

I found out that "i + 5" is causing it to freeze up. I was trying to for an incremental results of i by 5. Unless I use "i++", the loop will cause Flash to freeze up and/or crash. Of course, I found a workaround in which I declared a variable that will multiply i by 5.

I just wanna know why Flash crashes if I use i+5 rather instead of i++

This topic has been closed for replies.
Correct answer webqaflash

for (var i:int = 1; i <= 30; i=i+5)
{
     trace(i);

}

This the correct format to use for loop to increment a value of 5.

1 reply

webqaflash
webqaflashCorrect answer
Inspiring
May 13, 2010

for (var i:int = 1; i <= 30; i=i+5)
{
     trace(i);

}

This the correct format to use for loop to increment a value of 5.

c0jAuthor
Known Participant
May 13, 2010

much appreciated.


May 13, 2010

If i wanted to add a timeout. Let the banner loop every "X" quantity of seconds. Can it be done with this script?