- by admin
Q:I have an encrypted XML file that needs to be decrypted and displayed in Flash. The Encrypted XML file contains over 33000 characters, Flash crashes when I try to decrypt it. Is there a limit to amount of data that Flash can decrypt? I'm using rijndael to decrypt and Actionscript 2.0.
A:
Your problem is caused by the non-existing multithreading capabilities in Flash: All calculations are supposed to happen "in-between frames", i.e. user algorithms should not take longer to execute than the interval at which the screen is refreshed. If your calculation takes too long to finish, the Flash player will first start to drop frames, and (unless you changed settings) after 15 seconds show the warning you described.
You can get around this by "spreading" your algorithm across multiple frames, making sure only part of the calculation is executed until the screen is refreshed. You can do so by simply splitting up your encrypted string into small enough parts and executing an enterFrame loop to decrypt one at a time, or by implementing something like Alex Harui's PseudoThread class (which essentially does the same, but comes with encapsulation and all that Jazz).