From what I understand, the default behavior is that a view is destroyed when a user navigates away from it. This is good. There must be more to the story however.
I have an app that has three or four views. One of the views is complex and contains a video player. I notice when I leave this view using the "back" selection in the IOS iPad emulator, the video keeps playing. It, and its rtmp connection, are not destroyed.
What is the best practice here? What things are destroyed and what things are not? Should I be listening for viewDeactivate and manually destroying any of the view's subcomponents and variables?
Does anybody know the answer to this? Pretty important.
With the view's destructionPolicy for the view set to "auto" the view is supposed to be destroyed. It isn't. Is this a bug?
How do I truly destroy a veiw with a NetConnection and a NetStream that is playing? It's a heavy weight view with lots of components that I really want to take out of memory.
I was just dealing with this today on my app, which also has a view with a video object, netstream, netconnection, etc. I was seeing a lot of memory leakage on my device, which then caused the app to crash on the device due to it running out of memory.
here's what I suggest:
-Clean up, close and null all netconnection objects when leaving the view. You should also null all video objects as well. Anything additional that you might have instantiated in actionscript instead of the view mxml.
-The View will take care of discarding its components, any subviews that are present.
If you have FlashBuilder Premium you can use the Flex Profiler to see memory usage of your app when running in the simulator. If you're still seeing problems you can use that tool to diagnose your memory usage
Europe, Middle East and Africa