10 Replies Latest reply on Jul 27, 2009 11:28 PM by Panoma

    settimeout function in flash 10 (linux)


      have a strange problem. I wrote a flex application, which loads images from the local filesystem. There is a function, which checks, whether all images are loaded. I use the settimeout function to test regularely the state the images. If not all images are completed, I use settimeout to call the check function. Sometimes, the check function is not called, although not all images are loaded.


      I put traces in every line. Everything looks fine, but in rare cases, the application stopped working.


      Here is an excerpt of the check function (traces removed):


         private function CheckImagesLoaded():void {     


            var _LoadedImages:int=0;
             //check images
            if (myLogo._Loaded==true) {
            else {
              if (myLogo._Error!="") {

            //check of other images...

            // [...]

            if (_LoadedImages<_MaxImages) {

              TimeoutId=setTimeout(CheckImagesLoaded, 50);

            else {

              //start application




      Remark: myLogo is a class, the Event.COMPLETE Handler sets the Boolean Flag _Loaded to true, if the image is loaded.