0 Replies Latest reply on Oct 4, 2007 8:43 PM by mrSparkleS0ap

    memory/resource management questions?

    mrSparkleS0ap Level 1

      I am building a Flash CMS in AS 2.0 and have a sneaking suspicion that I may be wasting resources due bad cleanup.

      My App has a main SWF that handles loading/unloading menuItems.
      the mainApp logs in a user and then generates a dynamic menu. ( using PHP - XML )

      All menu items are external SWFs. They are loaded/unloaded into a stage_mc - which is actually a empty mc that I place on the stage in the main.fla and give a LinkageId to. I connect the mainApp w/ my dynamically loaded SWFs by passing it a couple Class references in the MovieClipLoader.onLoadInit event:

      public function onLoadInit(target_mc:MovieClip):Void {

      appLog.info("OnePointLoaderCtrl.onLoadInit() target_mc:"+target_mc);
      target_mc.init( stageMgr , appLog );


      the init function on each menuItem.fla resides on the first layer of its menuItem.fla

      function init( stage_mgr:StageManager , log:Logger) {

      MenuItem.main( this, stage_mgr, log );


      the MenuItem.main() is a static function that initiates the MVC relationship for that menuItem

      public static function main( target:MovieClip, stage_mgr:StageManager, log:Logger):Void {

      log.info("Login.main() target:"+target+" stage_mgr:"+stage_mgr);
      var menuItm:MenuItem = new MenuItem(target, stage_mgr, log);


      So, My question is : When I unLoadClip(stage_mc) what is removed?

      My menu items consist of a lot of dynamically created objects : Components, MovieClips, Custom Classes.

      Are these Objects *created* in the externally loaded menuItem.SWF ? or because they are created at runtime they are really in my mainApp?

      I don't use any references to the *container* mainApp for attaching dynamically created content to and all my menuItems have _lockroot=true before they are created.

      I attach a good amount of Listeners to dynamic Objects. Do the Listeners have to be removed if they are attached to an dynamically created Object that contained in its own SWF then unloaded?

      Any incite into flash's memory/resource management would be greatly appreciated..