1

I really need some help on this, as I have no idea how to fix it! :/

Got a problem here.

My application is working fine on my computer, both offline and online (flash uploaded to our webservers). It works fine in both IE and Firefox.

However, some user do have problem running it in IE, while Firefox is still ok..

The app itself works, the error comes when trying to buffer some frames to a BitmapData.

So, in Firefox, it works great. In IE (on my computer) it works great. In IE (on other computers) it does not work, and this error is cast. It happens right at the end, which means it all works fine until the last time the function is run. (it's run like this to allow updating the progressbar. If I set the for loop to 180 then it all freezes untill completed. Thats why I do 10 and 10.)

Any help regarding this would be great, as I'm completely stuck here... I've traced the size of the bitmapdata, and at the time of the error it's 1920x1080, which is what it's supposed to be.


This is the code where it fails:

fpsoSWFBuffer = new BitmapData(fpsoMC.width, fpsoMC.height, false, 0x00ff0000);

And this is the whole function where the code is located:

public function bufferFpsoImages(evt:TimerEvent):void{
            for (var i:int = 0; i<10; i++){
                fpsoMC.gotoAndStop(currentFpsoFrame);
                fpsoSWFBuffer = new BitmapData(fpsoMC.width, fpsoMC.height, false, 0x00ff0000);
                fpsoSWFBuffer.draw(fpsoMC);
                fpsoImgArray[currentFpsoFrame] = fpsoSWFBuffer;

                currentFpsoFrame++;
            }

            if (currentFpsoFrame <= (totImg360-10)){
                //   Still buffering frames   //    

                myLoadingPanel.setBufferProg(currentFpsoFrame);
                var fpsoTimer:Timer = new Timer(1,1);
                fpsoTimer.addEventListener(TimerEvent.TIMER_COMPLETE, bufferFpsoImages);
                fpsoTimer.start();

            }else{
                //   All frames buffered   //   
                currentFpsoFrame = 0;
                fpsoLoaded = true;
                fpsoLoading = false;

                ncFPSO.removeElement(myLoadingPanel);
                myLoadingPanel = null;


                var fpsoBitmap:Bitmap = new Bitmap(fpsoImgArray[0]);
                fpsoBitmap.smoothing = true;
                fpsoImage.source = fpsoBitmap;

            }
        }

EDIT: I've added some debugging functions to it now, to be able to know where it fails. (as it works during debugging, I need to debug the realtime version online).

This is what I get:

ErrorID=2015
ErrorMessage=Error #2015
ErrorPos=fpsoSWFBuffer = new BitmapData(1920, 1080, false, 0x00ff0000);
CurrentFpsoFrame=168
Position in For Loop=8

EDIT2: And here is the error message I finally got inside of Flash Builder. So now it's crashing here too.. =/

ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData/ctor()
at flash.display::BitmapData()
at Main/bufferTemplateImages()[E:\Workspace - Flash Builder\vCog Workspace\vCog Communicator 3.0\src\Main.mxml:461]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.utils::Timer/tick()
Stian Berg Larsen
  • 543
  • 2
  • 10
  • 29
  • Why do you use timer for recursion: var fpsoTimer:Timer = new Timer(1,1). Can you refactor code to make it clearer? – Ilya Zaytsev May 08 '13 at 10:17
  • I use the timer to "break up" the buffering. Since falsh is not multithreading, I need to update the progressbar while loading all the frames to the array. That's why I load 10 and 10 frames. – Stian Berg Larsen May 08 '13 at 10:23
  • I traced memory useage when it craches: 1472964KB.. But it works in Firefox. Is there any better way to buffer and store 180 fullHD frames? I need to be able to scroll through all these images smoothly (and thats why I buffer them to memory). It's a 360 "animation" where the user can click and drag the view to rotate around the scene (swaping out these prerendered images to give an illusion that the user is rotating around in 3D space). – Stian Berg Larsen May 08 '13 at 10:53

2 Answers2

1

Your buffering 1.5gb of memory? Flash keeps requesting memory from the OS until the OS can't give anymore. If it works on your computer, but not others, maybe their computers are running a lot of other program requesting memory and can't supply enough memory to your project. The other thing I would check is, what version of the OS they are using 32bit windows only can see a max of 2Gb of memory. Although This is simply a theory. Maybe try and compress the images first to limit memory usage.

  • It was crashing on my computer too lately (and I have 16GB memory). I had to downsize the files I buffer, and do it a different way to make it work. Do I did make it work by recoding the application. And it looks like the problem is that IE and Flash cant access more than about 1.5 GB memory before failing. Firefox can do that just fine... – Stian Berg Larsen May 10 '13 at 07:30
1

It seems like IE have some sort of max memory useage restriction with flash, and Firefox does not.

I might be wrong, but I fixed it by rewriting my code to handle smaller files (less memory useage) and loading in a high-res image after the user have rotated the view.

I used to buffer 1,5GB meory, now I buffer about 750MB and it works.

Still strange that IE has limitations, and Firefox and Chrome does not...

Oh well.. =/

Stian Berg Larsen
  • 543
  • 2
  • 10
  • 29