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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:08:26+00:00 2026-05-26T01:08:26+00:00

I have an established pattern for lazy loading data from a server via AMF.

  • 0

I have an established pattern for lazy loading data from a server via AMF.

    private var _XeventDispatched:Boolean;
    private var _X:ArrayCollection;
    public function get X():ArrayCollection{
        if(!_XeventDispatched && (_X==null || _X.length==0)){
            var evt:Event = new Event();//whatever event is need for this data member
            dispatcher.dispatchEvent(evt);
            _XeventDispatched = true;
        }
        return _X;
    }
    public function set X(ac:ArrayCollection):void{
        return _X;
    }

This way the data is not loaded from the server until it is needed. (I’m using the Mate framework by the way, so when a UI is instanciated, and the injectors fire, they call this get method in the data manager class.)

What I’d like to do is create some kind of Metadata tag, similar to [Bindable] that will add the above methods in place of a public property.

[LazyLoaded(eventName="com.myCompany.LoadX")]
public var X:ArrayCollection;

Does the compiler have any hooks for this type of extension? It would save a lot of boiler plate code that is hard to read.

  • 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-26T01:08:27+00:00Added an answer on May 26, 2026 at 1:08 am

    +1 Marty you lead me to this, but its different from your solution.

    I’ve created a base class (BaseDataManager) that all other Mate data managers can extend from, and in that class I’ve added the below code:

            private var eventsDispatched:Array = new Array();
            protected function lazyLoad(value:*, eventType:String):*{
                if(!eventsDispatched[event] && (value==null || (value is IList && IList(value).length==0))){
    
                    var clazzName:String = eventType.substr(0, eventType.indexOf(":"));
                    var eventClazz:Class = Class(getDefinitionByName(clazzName));
                    var event:Event = new eventClazz(eventType);
    
                    dispatcher.dispatchEvent(event);
                    eventsDispatched[event] = true;
                }
                return value;
            }
    

    Then within each data manager, if the property is to be lazy loaded, this is their accessors:

        private var _X:ArrayCollection;
        public function get X():ArrayCollection{
            return lazyLoad(_X, XLoadEvent.LOAD_EVENT_TYPE);
        }
        public function set X(value:ArrayCollection):void{
            _X = value;
        }
    

    This way most of the ugly, hard to read code is hidden away from the dev, yet still accessible for debugging if any problems were to arise.

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

Sidebar

Related Questions

I want to update data from my database using java. I have established my
I have established a link using Netbeans and Paradox driver and can query the
I have a plug-in vector established using System.AddIn that accepts the body of a
.NET's ProviderBase was established in the 2.0 release of the .NET Framework. Have there
Have you ever seen any of there error messages? -- SQL Server 2000 Could
I have a gps device that records data e.g. datetime, latitude, longitude I have
I'm curious to know what usage patterns people have established for themselves to utilize
I have a Windows service that logs speed readings from a radar gun to
I have implemented a java version of Producer && Consumer pattern in java and
I'm struggling to design the server-side script that responds to requests from an Ajax

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.