ActionScript Error 2015 With Firefox And Internet Explorer
Sometimes the InvalidBitMapData error is really masking something else. This error can occur with Firefox and IE7/8 by doing page refreshes. Here’s one way to work around it.
Doing a browser refresh shouldn’t result in anything exceptional, but certain Flash initialization demands, such as populating an image gallery, can result in a no show. It happens far more often with IE7 and IE8 than with Firefox. Chrome, Opera and Safari don’t have this rapid refresh problem.
Without going into the forensic details, the easily repeatable problem really is an out of memory detection that Flash reports as an invalid bitmap data error. Here’s the sequence of events.
From the browser 101 handbook, web page items are asynchronously built in the ordinary course of events. Flash items are launched by calling their constructors, which in turn build internal items and consume resources. Eventually, everything is completed. The Flash item probably has more smarts that the other page items, but the only thing it can be certain of is that its constructor was called, which is as close as Flash can get to an object complete event.
The visitor then refreshes the page.
The browser will start releasing page items in the ordinary course of events by sequentially going down the list built during the previous building sequence. When they are all released the page rebuild is started. But, the release is not the same as disposed and available.
The multistage garbage disposal is asynchronous, and reference counting continues apace, but variously behind the web page’s rebuild.
The Flash item is launched by calling its constructor, and when it goes for more memory, directly or indirectly, it hits an out of memory exception that is construed as InvalidBitMapData, because not all of the previous instance’s resources are actually freed, with some of them marked with process information that ultimately is related to the Flash’s registered program class. The confused memory manager ‘knows’ that the rebuilt Flash item is completely new and not an additional instance, and stops allocating any more memory to the class.
The solution to this specific problem (i.e., Flash errors when a page is refreshed) isn’t clean, but it does work, and is simple: Delay the Flash initialization, either with a timer (the easiest and most predictable) or by changing the order of initialization (probably a bit of work and unpredictable as processors are only getting faster).
For what it’s worth, we’ve found that this race problem disappears markedly with a timer value of 60ms for our set of machines (XP, Vista and Win7), the slowest one having dual 2.8G processors and 2GB of r/w memory. Very unlikely that anyone can hit the F5 key more than 16 time a second.
© Copyright 2010 Chuck Brooks for FutureWare SCG
Tags: actionscript, duplicate process handle, error 2015, firefox, internet explorer, out of memory, rapid browser refresh

April 29th, 2010 at 2:20
[...] Pełny artykuł na: Chuck Brooks For FutureWare » Blog Archive » ActionScript Error … [...]