for (var i = 0, index = condition ? 0 : count; i < count; ++i, index += condition ? 1 : -1) or something like that, but there's almost always a better way to design it.
Is it possible to conditionally change the direction of a for loop in ActionScript?
Example:
for(if(condition){var x = 0; x<number; x++}else{var x=number; x>0; x--}){
//do something
}
Interesting requirement. One way to keep the for is:
var start, loop_cond, inc;
if(condition)
{
start = 0;
inc = 1;
loop_cond = function(){return x < number};
}
else
{
start = number - 1;
inc = -1;
loop_cond = function(){return x >= 0};
}
for(var x = s...
ok thanks
I loved upvoting an idea which I then commented on and said "This is not a good solution, don't use it" :-D
@TheUnhandledException We don't even use the system anymore, but apparently it reset itself one day and started sending out emails about things we finished two years ago..
I'm making an image gallery and I want to have a bunch of thumbnails on the bottom of the screen that smoothly slide from side to side when the mouse moves.
I'm working with a custom class for the container (Tiles) and a custom class for the thumbnails (ImageIcon).
I have a ComboBox which all...
For the XMPP interface for the Stack Overflow chat, I am currently taking the HTML of the chat messages and converting to valid XML, and setting that as the html child element of the XMPP message object. In my Mac OS X jabber client this was working great! It meant that when users in the SO chat ...
When people quote others, it is common practice to add a source or attribution of the original speaker. When you select text and hit the quote button, there should be a pop-up that asks for an optional attribution. The attribution should be added and formatted in some way as well.
(While I orig...
Sorry I was busy getting piled on for not putting a regex in a code block and having 800 people think I don't know ( is a special character as a result.