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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:16:08+00:00 2026-06-06T19:16:08+00:00

I’m having trouble creating multiple AS3 classes, I’ve got my document class but can’t

  • 0

I’m having trouble creating multiple AS3 classes, I’ve got my document class but can’t get other classes.

Below is an example.

~Main.as

package {
    import uk.co.epickris.project.*;

    public class Main {
        public function Main() {
            trace('Main constructor.');
        }
    }
}

~/uk/co/epickris/project/Example.as

package uk.co.epickris.project {
    public class Example {
        public function Example() {
            trace('Example constructor.');
        }
    }
}

After running my flash project, I see the main constructor, but no the example constructor, I’m not sure what I’m doing wrong if anything, any advice would be helpful.

  • 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-06T19:16:08+00:00Added an answer on June 6, 2026 at 7:16 pm

    You need to initialize your Example class by creating an instance of it within the document class.

    package
    {
        import uk.co.epickris.project.*;
    
        public class Main
        {
            public function Main()
            {
                trace('Main constructor.');
    
                // We're creating an instance of the Example class here.
                var eg:Example = new Example();
            }
        }
    }
    

    Classes do not automatically have their constructor called when they are imported at the top of a class – instances of classes need to be created with the new keyword.

    When the new keyword is used to create an instance, the constructor (defined by creating a function with the same name as the class) will be called as well.

    Your document class is the only class in your case that is created and has its constructor called automatically, as that is the nature of a document class.


    Please take some time to read this article about the basics of Object-oriented programming in AS3:
    Introduction to OOP

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.