title: Flex: Which way should I add this event handler?
body: <p>I use a unit of work pattern a lot in my flex projects.  I'll have a class that might call a web service, put the data in a sqlite db, refresh a model with the data then raise an event.</p>
  
  <p>I usually call these inline and pass in some singleton classes:</p>
  
  <pre><code>protected function CareerSynced():void
      {
          var process:ProcessWorkouts = new ProcessWorkouts(_dataModel, _trainerModel, _databaseCache, _database.Conn);
          process.addEventListener("AllWorkoutsProcessed", AllWorkoutsProcessed);
          process.UpdateAllUnprocessed();
      }
  </code></pre>
  
  <p>I'll then get the response like this:</p>
  
  <pre><code>private function AllWorkoutsProcessed(event:DataReceivedEvent):void
      {
      //do something here 
      }
  </code></pre>
  
  <p>My question is, am I adding that event listener correctly?  I think I might be causing a memory leak, but I'm not sure.  I've also thought about using a weak reference.  I'm confused about when to use them.   Would this be one of those cases?</p>
  
  <p>Should it be like this?</p>
  
  <p><code>process.addEventListener("AllWorkoutsProcessed", AllWorkoutsProcessed,false, 0, true);</code></p>