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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:28:55+00:00 2026-05-27T09:28:55+00:00

I have x amount of classes in a package eg. com.trevorboyle.lotsofclasses and I keep

  • 0

I have x amount of classes in a package eg. “com.trevorboyle.lotsofclasses” and I keep adding more (These classes will probably all be static and will probably all extend the same class).

I wish to create a drop-down list of all these classes, preferably without having to manually create an array myself.

Once a class is selected from the list, I’ll be able to use getDefinitionByName to return it, because I will know it’s name at this point.

The question is, as I believe there is no support in AS3 to list all the classes in a specific package, is there a design pattern that handles this?

  • 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-27T09:28:55+00:00Added an answer on May 27, 2026 at 9:28 am

    There are two ways:

    First, traditional clean as3 implementation:

    Create a class that registers all the classes of your interest at class initialization (when it’s first used in code).

    Something like this:

    package   {
    import flash.utils.getQualifiedClassName;
    
    public class ClassesRegister {
    
        private static const PACKAGE_RESOLVER_PATTERN   : RegExp = /^(?P<packageName>[a-zA-Z_\.]+)::/;
    
        private static const registeredClasses : Object = { };
    
        public static function registerClass ( clazz : Class ) : void {
    
            var packageName : String = PACKAGE_RESOLVER_PATTERN.exec( getQualifiedClassName( clazz ) ).packageName || "";
    
    
            if ( !registeredClasses[ packageName ] ) {
                registeredClasses[ packageName ] = [];
            }
    
            registeredClasses[ packageName ].push( clazz );
    
        }
    
        public static function getClassesOfPackage ( packageName : String ) : Array {
    
            return registeredClasses[ packageName ].concat();
    
        }
    
    }
    

    }

    Class registered on initialization:

    package   {
    
    public class SomeClass {
    
        // Add class to register in static initializer
        {
            ClassesRegister.registerClass( SomeClass );
        }
    
        /**
         * Class constructor
         */
        public function SomeClass () {
    
        }
    
    }
    

    }

    And there is another, not tested by myself but very promising:
    Use as3commons bytecode library.

    Class ByteCodeTypeCache in property definitionNames stores all fully qualified definition names that have been encountered in all the bytecode that was scanned. You can just iterate through that list and take what you need. Of course you have to make sure that all classes you will need on runtime is compiled into bytecode (you have to initialize those classes somewhere or use as3 compiler directives).

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

Sidebar

Related Questions

i have domain classes: package test class Credit { String name; static hasMany =
I have different classes all arranged in a hierarchy. To reduce the amount of
I've a window that will have an unknown amount of text fields, determined by
I have a VB6 EXE project with a large amount of classes - everything
I have a scenario whereby I want n amount of classes to look at
let's have these classes: public class MyObject { //constructor and other stuff public bool
I have 2 classes with overloaded operators in a namespace called Dinero, these are
I have a bunch of Repository classes which all look a bit like the
I have a large amount of audio stored on my web server in a
I have a large amount of data I need to store, and be able

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.