Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5940741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:00:38+00:00 2026-05-22T16:00:38+00:00

I use a unit of work pattern a lot in my flex projects. I’ll

  • 0

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.

I usually call these inline and pass in some singleton classes:

protected function CareerSynced():void
    {
        var process:ProcessWorkouts = new ProcessWorkouts(_dataModel, _trainerModel, _databaseCache, _database.Conn);
        process.addEventListener("AllWorkoutsProcessed", AllWorkoutsProcessed);
        process.UpdateAllUnprocessed();
    }

I’ll then get the response like this:

private function AllWorkoutsProcessed(event:DataReceivedEvent):void
    {
    //do something here 
    }

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?

Should it be like this?

process.addEventListener("AllWorkoutsProcessed", AllWorkoutsProcessed,false, 0, true);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:00:39+00:00Added an answer on May 22, 2026 at 4:00 pm

    I would either go with the weak reference or just remove the listener:

    private function AllWorkoutsProcessed(event:DataReceivedEvent):void
    {
         event.target.removeEventListener("AllWorksoutsProcessed",AllWorkoutsProcessed);
    }
    

    I could list out my reasons but I’ll just point you to this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I use the unit of work pattern (with JPA), I get an entity
We have Unit of Work implemented in EntityFramework, so when we use ObjectContext and
I usually use the Hibernate ThreadLocal session management pattern in Java web projects: The
So I have this problem in PHP, I have a class called unit that
How should I use the unit of work pattern in the following scenario: I'm
How we can use Unit of Work pattern with (Entity Framework 4.1) code first
I have read in Patterns of Enterprise Application Architecture that a Unit Of Work
I am trying to use the Unity IoC with the unit of work &
I personally don't use FxCop yet. We want to work out the unit testing
I want to build a windosform application using Repository and Unit of Work pattern.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.