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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:53:00+00:00 2026-06-03T14:53:00+00:00

I am developing an Air application that interacts with my server. There are plenty

  • 0

I am developing an Air application that interacts with my server. There are plenty of various methods related to different subjects.

To structure that, I introduce a master ‘API’ object and several extenders of it, each implementing methods for particular Subject. Each of them uses the master API _call method that actually makes a call to server.

How do I set the master API, so that I could reference its children like so:

var Api:myMasterApi = Application.getApi();

// Now do the API calls:
Api.Subject1.Method1();
Api.Subject2.Method3();

I tryed setting MasterApi public static properties to the instantiated subclasses, perhaps in a wrong way:

class myMasterApi {
    public static Subject1:mySubject1 = new mySubject1();
    public static Subject2:mySubject2 = new mySubject2();

    protected function _call( args... ) { /* does the call */ }
}

And the extenders are like so:

class mySubject1 extends myMasterApi {
    public function Method1( args... ) {
        prepare things;
        this._call( args ); // do the call
    }
}

Is this the right approach to a structured implementation of API, or I’m on the wrong track?

The problem I’m stuck with is that when Api.Subject1 is not static it creates stack overflow by circular self reference: as its base class has Subject1 as a property.

When Api.Subject1 is static, it gives error 1119: “Access of possibly undefined property post through a reference with static type …”

  • 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-03T14:53:04+00:00Added an answer on June 3, 2026 at 2:53 pm

    You’re mixing up two different fundamental OOP concepts: composition and inheritence. It probably doesn’t make any sense for your specific Subject classes to be extending MasterApi (inheritence) AND have the MasterApi contain an instance of each of its descendents. It is circular.

    What you may want to do instead is have a base Subject class that each of the specific Subjects extends, so that they can all use some common methods, and then have your MasterApi be an unrelated class that contains a singleton instance of each of your specific Subjects.

    ‘Singleton’ is just a term meaning “it’s an instance (not a static class), but there is only and exactly one of them”. This is exactly what you get by declaring your static properties and setting them to new instances of the specific Subject classes.

    A barebones example (excluding imports statements, etc). I have no idea what your “subjects” are so I just present some made up properties:

    class SubjectBase {
        private var _name:String;
        private var _description:String;
    
        public function SubjectBase() {  }
    
        protected function loadSubject(subjectID:String):void {
            var qResult:Object = SomeClass.SomeMethodThatQueriesYourServer(subjectID);
            _name = qResult["SUBJECT_NAME"];
            _description = qResult["SUBJECT_DESC"];
        }
    
        public function get name():String {
            return _name;
        }
    
        public function get description():String {
            return _description;
        }
    }
    
    class Subject1 extends SubjectBase {
        public function Subject1() {
            super();
            loadSubject("SUBJECT1");
        }
    }
    
    class Subject2 extends SubjectBase {
        public function Subject2() {
            super();
            loadSubject("SUBJECT2");
        }
    }
    
    class MasterApi {
        private static _subject1:Subject1 = new Subject1();
        private static _subject2:Subject2 = new Subject2();
        public function MasterApi() { }
        public static function get subject1():Subject1 { return _subject1; }
        public static function get subject2():Subject2 { return _subject2; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a Flex Air (desktop) application that loads images from the local filesystem
I'm developing a Adobe Air application that should make use of a SWF file
I am developing an AIR application. This application needs some hardware accesses that are
I'm developing an application using Flas Builder / Flex for Adobe Air. This application
I'm developing a multi monitor fullscreen application with Adobe Air 2.6. I can create
I spent hundreds of ours developing an Adobe AIR Application with Flex 4.0 and
I'm developing some sort of air mouse application for iPhone platform. This applications connects
Is there a way to launch an Adobe Air Application from the browser? I
We are considering developing an application in Adobe AIR. However, one of the criteria
I am developing a chat application for Android, using AIR/Flex and Red5. But Acoustic

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.