Actionscript that bothers IE

I recently cleared up a bug with Question Writer that was causing it to create Flash files that would crash Internet Explorer. This turned out to be a particularly difficult problem because there were two separate issues that were causing the same intermittent error. A real problem bug because it was difficult to reproduce, difficult to isolate and difficult to confirm fixes once in place.
iecrash.gif

I won't bore you with the details of how it all got fixed, but there were two pieces of actionscript code that increase the likelihood of an Internet Exporer crash that I want to make available so that you don't also have to spend 18 hours drinking expresso to get to the bottom of it.

new XML("");

Trying to create an XML object from an empty string. Not a very sensible or useful thing to do - only occurs when loading in XML from an external source that happens to be empty file or similar circumstances. Anyway, bad idea, check for an empty string before making an XML object.

Accessibility.updateProperties()

Calling this method too many times in rapid succession seems to destabalize the Flash player in IE. Macromedia's advises not to call this method too often as it might confuse the screenreader. I'd go one further and say it risks crashing IE. My approach now is to only call this method if a screenreader is actually active. There's probably a slight performance gain to that too.

It's worth noting that these problems may just be contributing to a more complex issue as they only seem to cause a problem in the context of a larger movie - I tried creating a Flash file with just these commands alone, but that runs fine.

For searching, I'll also include the original error that I was searching for when the problem initially occurred - this is returned when Flash crashes .NET although others advised that this error also occurs sometimes when trying to send data between .NET and a hosted Flash object.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.AxHost.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Update on this: The problem contined to occur after removing the calls to Accessibility.updateProperties() - I'm of the opinion now that the problem was entirely down to the XML object, but that the updateProperties() was exacerbating the problem, but not enough to cause it by itself.

Posted by Alexander at August 23, 2005 09:19 AM

Make Flash tests and assessments with the Question Writer, Quiz Software. Question Writer 4 is now available. Click here to download.

Comments

Has anyone found a solution to this problem, if so what is it?

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)

.....etc

Posted by: joseph at May 5, 2006 01:57 AM

Joseph, I found that reducing the amount of XML processing solved the problem for me - also I think the XML processing ability is improved in Flash 7 and Flash 8 over Flash6, so requiring a more recent player might help alos.

Posted by: Alexander McCabe at May 5, 2006 05:38 AM

Add a couple slideshows on Myspace and sit on the page for a short while and IE 6 and 7 will crash.

The more slide shows the sooner it crashes.

You all sound like you are into it deeper that I am. But that's what I know happens. I have been looking for a fix and ran across this post.

I have Flash player v.9 supposed to be the latest version but not sure if I was bent over or not.

But too adding more than one slideshow does it every time.


Posted by: IE crash test dummy at September 5, 2006 07:06 AM