Anyone who has done any OpenLaszlo (or Flash-related) development has inevitably come across those dreaded Script-Running-Slowly errors. They’re caused by the application taking too long to process a piece of script. e.g. An infinite (or very long) loop, creating too many views at once or a large number of chained constraints.
Happily, there’s now a cure. As of Flash 7 (which is the minimum supported Flash runtime in OpenLaszlo 4.0+), the criteria for triggering these errors are configurable. Hopefully this feature will make it into the OpenLaszlo platform, but for now, you can use the Windows
SWF ScriptLimits Injector (SWFSLI) program to tweak these criteria.
- Download the SWFSLI program from: http://www.buraks.com/swfsli/
- Compile your OpenLaszlo application SOLO using proxied=”false” in the canvas.
- Run SWFSLI against the newly-compiled SWF:
swfsli myapp.lzx.lzr\=swf7.swf /r65535 /t300 /b
That’s it. SWFSLI will adjust the settings in your original SWF file, and make a backup copy. To deploy, you’ll need a wrapper page. Note that this won’t make your application run faster; it’ll only loosen Flash’s criteria for throwing the Script-Running-Slowly error.
I created two examples (before.swf and after.swf). Both of these run 10,000,000 iterations and then print that they’re done. On my laptop, before.swf consistenly throws the error, after.swf never does:
One thought on “Tell Those Pesky Script-Running-Slowly Errors Where to Go”