Jquery each() goes faster as load()
===

I have something like this

    function loadImages(){
       var num = 1;
       $('.myElement).each(function(){
          var image = $("<img>").attr("src",mySrc).load(function(){
             if(num == 1){
                //do something - does not work
             }
          });
       });
       num++;
    }

And condition if(num == 1) does not work at all. I think, it's because while first image will be loaded, each() function still works and var num has some greater value, as my condition inside load() function goes to play... how can I fix it?

thx