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 6228339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:22:18+00:00 2026-05-24T09:22:18+00:00

I have a object that is extended from arraycollection. This object has to access

  • 0

I have a object that is extended from arraycollection. This object has to access and manipulate the arraycollections source object. When this happens, the local sorted/filter copy of data goes out of sync with the source data. To line things up correctly, the sort/filter needs to be re-applied.

To do this normally, you would call refresh() on the arraycollection, but this also broadcasts a refresh event. What I want is to update the sort/filter without dispatching an event.

Having looked into the ArrayCollection class, I can see it is extended from ListCollectionView. The refresh function

public function refresh():Boolean
{
    return internalRefresh(true);
}

is in ListCollectionView and it calls this function

private function internalRefresh(dispatch:Boolean):Boolean
{
    if (sort || filterFunction != null)
    {
        try
        {
            populateLocalIndex();
        }
        catch(pending:ItemPendingError)
        {
            pending.addResponder(new ItemResponder(
                function(data:Object, token:Object = null):void
                {
                    internalRefresh(dispatch);
                },
                function(info:Object, token:Object = null):void
                {
                    //no-op
                }));
            return false;
        }

        if (filterFunction != null)
        {
            var tmp:Array = [];
            var len:int = localIndex.length;
            for (var i:int = 0; i < len; i++)
            {
                var item:Object = localIndex[i];
                if (filterFunction(item))
                {
                    tmp.push(item);
                }
            }
            localIndex = tmp;
        }
        if (sort)
        {
            sort.sort(localIndex);
            dispatch = true;
        }
    }
    else if (localIndex)
    {
        localIndex = null;
    }

    revision++;
    pendingUpdates = null;
    if (dispatch)
    {
        var refreshEvent:CollectionEvent =
            new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
        refreshEvent.kind = CollectionEventKind.REFRESH;
        dispatchEvent(refreshEvent);
    }
    return true;
}

annoyingly, that function is private and so is unavailable to and class that extends ListCollectionView. Also, a lot of what is in the internalRefresh function is private too.

Does anyone know of a way to call internalRefresh from a class that extends ArrayCollection? Or a way of stopping the refresh event from being dispatched when refresh is called?

  • 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-24T09:22:21+00:00Added an answer on May 24, 2026 at 9:22 am

    My (read:hack) solution to this:

    addEventListener(CollectionEventKind.REFRESH, handlerHack, true);
    

    The true adds this listener onCapture, before anyone else gets to act on the event.

    Before you call the collection.refresh() to update sort/filter, set a boolean flag to true.

    discardRefreshEvent = true;
    myCol.refresh();
    

    In the listener…

    private function handlerHack(evt:CollectionEvent):void
    {
        if (discardRefreshEvent)
            {
                evt.stopImmediatePropagation();
                discardRefreshEvent = false;
            }
    }
    

    Disclaimer: Haven’t done this exact use before (have implemented similar functionality with other events), also only guessing on Event types/names.

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

Sidebar

Related Questions

I have an Activity that pulls an object from an Application extended class (application
I have two tables: object that has object_id column and avalues that have object_id
I have an object that can build itself from an XML string, and write
I have an object that has a list of abstract 'aninamls'. i.e. var animals
I basically have an object, extended with a function through its prototype. Inside that
How can I access an extended Class function from an already created object? (A)
In my program I have a class GraphDisplay extended from JPanel that is used
I have a camera object that I have put together from reading on the
I have an object that is mapped to a cookie as a serialized base-64
I have an object that implements IDisposable that is registered with the Windsor Container

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.