I can use a few suggestions on how to handle a bind I may have worked myself into on a current Flash project. I am working in Actionscript 3.0 for only the second time and have run up against a processor utilization and memory leak issue. Not being familiar with AS 3.0 Garbage Collection processes yet I can use some recommendations on how I might try to optimize the project. I do have some specific questions that should help guide a response. I realize that mine is not an OOP based approach, of which I am not yet familiar, but I did want to cut my teeth on AS 3.0 syntax and methods so I hope you can help.
The Project
Essentially, I have created a PowerPoint-style “slide” presentation targeted for playback on the users system or in a convention kiosk situation (not online). It includes 50 individual frames with frame scripts that call functions in my Actions layer with TweenMax tweens for movieclips stored off stage at each frame location. 30 screens are simple bulleted copy with static graphics support. Simple TweenMax tweens are used for the “builds” of text and graphics.
20 of the frames contain processor-crushing animations using pretty much the same artwork in each animation, but with subtle variations. These animations are running slow and memory is building up every time they play (they leak). The background is complicated with gradients and glows and the foreground animations include alpha effects and some blur effect tweens. There is regular use of an infinite repeating “arrow” dataflow effect. These animations are often asking for 90% of the processor power to run. I have simplified some of elements and tweens to be more efficient. I am pretty sure I can improve the processing requirements with some simple graphic and tween changes…my biggest concern is the hidden processing that may be going on that I don’t yet know how to control in AS 3.0.
The Graphics
The graphics are based on photos and illustrations that been Photoshopped with transparent backgrounds and saved out and imported into Flash as PNG files with transparent mattes. In Flash these are set for smoothing, Loss/PNG and image as bitmap. I have attempted to match image sizes between the originals and the Flash imports to minimize resizing. Every MovieClip in the presentation is already on the stage at each frame location. By not using AS to instantiate and addChildren to the display list programmatically I understand that I have surrendered control of these MC’s to the timeline. To Garbage Collect any of my MC’s I will need a way to remove them AND re-instantiate them and addChild them back to their starting positions if a presentation user wants to revisit a frame. I am not so much concerned about the GC’ing the text build frames, but the complex animations will definitely need some sort of further optimizing and a GC routine.
My Questions:
[LIST=1]
[]I understand that MC’s with repeating animated sequences continue to use processor time even when they are not longer on the Stage.
[LIST]
[]Is that true?
[]Does stopping their timeline then reduce processing requirements?
[]How about MC’s that remain on the Stage in a frame not presently being shown? Does the system continue to try to process the difference between complicated foreground elements and the background in these cases or does this only happen when the MC is visible on the screen? If the former this sounds like this would be the source of a lot of memory and processor waste if you leave MovieClips on Stage in frames not being shown.
[/LIST]
[]Do the TweenMax tweens keeping running in memory even though they only appear on a frame by frame basis and should only be triggered once per frame? To enable garbage collection I understand that all references to any object/MovieClip must be severed. Do I have to programmatically delete the TweenMax references to enable GC as well?
[]I have reused MovieClip instance names in each frame for elements already on the stage to simply target TweenMax tweens from within one function. Does this complicate GC? Anyway around this problem without having to create, add, remove and GC a myriad of additional MC instances for each of the bulleted text lines throughout the presentation?
[]Is there an existing function that you can point me to that will help me cleanly sever all the references to existing MovieClips on a given frame to make then available for GC?
[]I have been removing and re-adding EventHandlers to the on-screen navigation buttons in each frame to keep the user from navigating away from a frame until a series of TweenMax sequences play through. Is this bad to do? Am I wasting memory doing it this way?
[/LIST]