iam currently working with DynImage

this object has various methods of loading status ie

DynImage.onLoading() // fires every 25ms till onLoaderDone fires
DynImage.onLoaderDone() // fires once when all images have loaded

now the problem i have is i would like to fire a function
ONLY when a image has loaded (ie 10 images = 10 calls to my function)
not every 25ms as it is currently doing,

ok easy so i thought, i would edit the dynimage.js to
add a function at the same time as
the DynImage.ItemsDone variable is incremented


- - - - - - - - dynimage snippet1 - - - - - - -

DynImage.loadercheck=function() {
 DynImage.ItemsDone=0;
 var max=DynImage.loadimages.length;
 for (var i=0; i<max; i++)
 if (DynImage.loadimages[i].img.complete) {
  DynImage.ItemsDone+=1;
  if (DynImage.nLoaded) DynImage.nLoaded() // added extra function here
 }

- - - - - - - - end snippet1 - - - - - - -

so in theory this should call my DynImage.nLoaded()
at the same time as the DynImage.ItemsDone variable is incremented,
however it still seems to be called every 25ms

i performed this test
by attaching a status counter to the function in my main code

- - - - - - - - code snippet2 - - - - - - -

var testInc=0
DynImage.nLoaded = function(){
testInc+=1;
window.status = testInc + " - " + DynImage.ItemsDone
}
- - - - - - - - end snippet - - - - - - -


now the testInc and DynImage.ItemsDone should be the same values as they are
both called at the same time but testInc just increments to infinity yet
itemsDone doesnt even tho they are both called at the same time.

so any ideas how i can attach a function that is only called only _once_ for
each image that is loaded instead of the current 25ms interval

thanks guys

Andy Short


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to