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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:33:40+00:00 2026-05-25T16:33:40+00:00

I have a custom component that extends the spark list. Inside that custom list,

  • 0

I have a custom component that extends the spark list.

Inside that custom list, I’m looking to declare a public function that can be called from the main application to filter the result of the list using filterFunction.

My problem is I have multiple filters and I need to pass the function name from the main application as a string ( Or by another way I will learn today! 🙂 ) like this :

My custom list

<s:List xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx" dataProvider="{listView}">

<fx:Script>
    <![CDATA[

        public function applyFilter(functionName:String):void
        {
            listView.filterFunction = functionName as Function // <-- THIS DOESN'T WORK;
            listView.refresh();
        }

        private function myFilter(obj:Object):Boolean
        {
            // Execution code
        }

        private function anotherFilter(obj:Object):Boolean
        {
            // Execution code
        }

    ]]>
</fx:Script>

Call from my main app

<fx:Script>
<![CDATA[

private function callMyCustomListFilter():void
{
    myCustomList.applyFilter('myFilter');
}

]]>

No error, nothing. The filterFunction is just not executed… Can somebody help? Thanks a lot!

  • 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-25T16:33:41+00:00Added an answer on May 25, 2026 at 4:33 pm

    My problem is I have multiple filters and I need to pass the function
    name from the main application as a string

    Pass the function as a function. Your apply filter function would be something like this:

        public function applyFilter(functionName:Function):void
        {
            listView.filterFunction = functionName;
            listView.refresh();
        }
    

    Then your parent container of the list would have something like this:

    public function myFilter(item:Object):Boolean{
    
    }
    
    private function callMyCustomListFilter():void
    {
        myCustomList.applyFilter(myFilter);
    }
    

    I didn’t notice you had the filter functions inside the list component. But, you can make them public and pass them in the same way:

        public function applyFilter(functionName:String):void
        {
            listView.filterFunction = functionName as Function // <-- THIS DOESN'T WORK;
            listView.refresh();
        }
    
        public function myFilter(obj:Object):Boolean
        {
            // Execution code
        }
    
        public function anotherFilter(obj:Object):Boolean
        {
            // Execution code
        }
    
    ]]>
    

    And this:

    <fx:Script>
    <![CDATA[
    
        private function callMyCustomListFilter():void
        {
            myCustomList.applyFilter(myCustomList.myFilter);
        }
    
        ]]>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom component, that contains a list of another components. If I
I have created a Popup that is custom component extends Canvas i want the
I have a custom component that extends a panel. The panel has a top
I have created a Custom Event, that is fired from a custom component. It
I have a component where i want to display a custom jtooltip. That is
I have written a new custom component derived from TLabel. The component adds some
I had a custom MXML component, that I have converted to a pure AS3
I have a custom event class public class FFTDrawEvent extends Event { public static
I have a JTabbedPane with a custom tab component. That component contains a JLabel
I have a custom component which extends LinearLayout, I need to execute certain statements

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.