View Single Post
07-11-2006, 05:28 PM
#1
170Designs is offline 170Designs
Status: Junior Member
Join date: Jan 2005
Location:
Expertise:
Software:
 
Posts: 42
iTrader: 0 / 0%
 

170Designs is on a distinguished road

  Old  Immediate Javascript Help Needed

I have this script where I upload many images at once then I can rotate them individually through a Javascript script. The Javascript rotation works perfectly with few images but messes up with a lot of images. When there are a lot of images uploaded at once, if I click to rotate one of the images, it actually rotates another image. I ran this by someone else and he said "that's probably because the array containing the image names is out of order."

My site is http://www.gigmax.com. If you want to see the problem yourself, just login as username account2 and password account2 and go to the Create Album tab in the My Gigmax section. After you do that, go ahead and select like 20+ images (of any size) then Upload them. Once you do that, you will see what I mean on the next screen when you try to rotate them.

Here is the code:
Code:
function step_2_rotate(o_src)
{
    var i_event_row;
    if (o_src.id.match(/(\d+)$/)) {        
        i_event_row = Number(RegExp.$1);
        var i_angle = o_src.id.indexOf('left') >= 0 ? 3 : 1;
        
        var row_this = -1;
        for (i = 0; i < o_files_data.length && (row_this < 0); i++) {
            if (o_files_data[i].index == i_event_row) {
                o_files_data[i].angle = (Number(o_files_data[i].angle) + i_angle) % 4;
                row_this = i;
            }               
        }        
        step_2_draw_table();        
    }
}
Thanks,
Matt