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

  • Home
  • SEARCH
  • 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 8680309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:12:55+00:00 2026-06-12T21:12:55+00:00

I have one class named as EmployeeResult where I am getting the response from

  • 0

I have one class named as EmployeeResult where I am getting the response from the service. Inside the resulthandler I am getting an array of employees like name, id, age etc. I have one dataGrid inside the employeeView.mxml file. Inside the employeeView.mxml file I have an ArrayCollection which is the dataprovider to the datagrid. I want to update that arraycollection from inside the EmployeeResult file. When working with Cairngorm framework I have used the arraycollection inside the singleton to achieve the goal. In case of mate framework I have used the propertyinjector tags. But how do I achieve this objective in my case without any framework. How to achieve property injection without using ane framework or singleton class.

  • 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-06-12T21:12:57+00:00Added an answer on June 12, 2026 at 9:12 pm

    Continuing on your previous question: How to listen to events inside the child component dispatched by the parent component, you can simply dispatch a custom event containing that list of employees and notify the entire application of its arrival.

    Something like this:

    private function handleMyEmployeeResults(event:ResultEvent):void {
        var employees:IList = EmployeeResult(event.result).employeeList;
        dispatchEvent(new EmployeeEvent(EmployeeEvent.LIST_LOADED, employees, true));
    }
    

    Since this is a service result handler, we may assume that its class instance is not a view and hence it is not on the display list, which is why the event can’t bubble. To address this we can dispatch the event directly on the stage.

    FlexGlobals.topLevelApplication.stage.dispatchEvent(
        new EmployeeEvent(EmployeeEvent.LIST_LOADED, employees)
    );
    

    Any view in your application can now listen for this event and set its properties accordingly:

    //inside View1
    stage.addEventListener(EmployeeEvent.LIST_LOADED, handleEmployeesLoaded);
    
    private function handleEmployeesLoaded(event:EmployeeEvent):void {
        myDataGrid.dataProvider = event.employees;
    }
    
    //inside View2
    stage.addEventListener(EmployeeEvent.LIST_LOADED, handleEmployeesLoaded);
    
    private function handleEmployeesLoaded(event:EmployeeEvent):void {
        myOtherKindOfList.dataProvider = event.employees;
        myFirstEmployeeLabel.text = 
            event.employees[0].firstname + event.employees[0].lastname;
    }
    

    Another more straightforward approach is to use your Application as a singleton. Create a bindable property employeeList on your main application. Now set its value when the results come in:

    private function handleMyEmployeeResults(event:ResultEvent):void {
        var employees:IList = EmployeeResult(event.result).employeeList;
        FlexGlobals.topLevelApplication.employeeList = employees;
    }
    

    Now you can bind to this property from anywhere in your application.

    <View1>
        <s:DataGrid dataProvider="{FlexGlobals.topLevelApplication.employeeList}" />
    </View1>
    
    <View2>
        <s:List dataProvider="{FlexGlobals.topLevelApplication.employeeList}" />
    </View2>
    

    Though this approach has the merit of being very easy to implement, it has all the downsides of a Singleton (e.g. poorly testable).

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

Sidebar

Related Questions

I have one grails application.In that I have one model class named Book. From
I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
i have one problem with handling list,i have three class named as UserInf,userData,userProcess,i created
Suppose I have a class named Data . Another class annotates one of its
i am facing one problem.i have a class named ReportingService and it should be
I have an IPAddress class which has one property named ip and in its
I have multiple datepickers in one page. I user class name to set the
I am have one class named country , it has three NSMutableArray country_name, latitude
I have a LINQ -> Class file named MoviesDB.dbml, I have added one table
I have one class named handler and this class process the http request comming

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.