Hang after running for awhile

Hi,

I have a not-so-complex flash. It has cover flow implementation using Papervision 3D. My scene has 3 covers. Clicking one of them will move the covers to the bottom right corner (minimizing), giving the left space a blank area. Cover flow has some tweens. Minimizing also has tweens. When there is no mouse down/mouse drag event in 30 seconds, a timer is trigger to run the flow automatically (moving the covers around - a fake screen saver). Each cover displays an embedded flash for animation.
In summary, my flash has:

  • 3D scene from PaperVision 3D
  • Embedded flashes for covers
  • Timers for screen saver
  • Tweeners for flow animations
  • FSCommand and ExternalInterface Callback (explain later)

The problem:
When the flash is used within a web browser, it runs well. However, when I integrate it with a Windows C++ program (using flash.ocx of course). This program does not show flash window on screen but it just copies the image buffer from the flash window. This makes the CPU works harder. The flash uses FSCommand to call a function from C++ program and executes registered callback function when the program notifies the flash.
After a number of calls of FSCommand and callback the flash just stops drawing and stops responding for input events in random places.

Using debug version of flash.ocx sometimes shows “Stack overflow” or “15 sec timeout” or it just hangs without any notification. My code has no recursive functions actually.

Please suggest to find the causes of the hanging.
Thanks