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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:49:19+00:00 2026-06-07T15:49:19+00:00

I’m having an issue with a little app I’m trying to create at the

  • 0

I’m having an issue with a little app I’m trying to create at the moment, it’s my first try and dealing with classes but for some reason I can’t create any instances of the class even if it’s imported into the document. Here’s the code for the class (named “Players”):

package
{
public class Player
{
    public function Player(name_:String)
    {

    }

    public var name_:String;
    private var alignment:int;
    public var healed:Boolean = false;
    public var revealed:Boolean = false;
    public var attacked:Boolean = false;
    public var dead:Boolean = false;

    public function action(target:Player)
    {

    }

    public function describe():String
    {

    }
}

public class Citizen extends Player
{
    public function Citizen(name_:String)
    {
        alignment = 1;
    }

    override public function action(target:Player)
    {

    }

    override public function describe():String
    {
        return "Citizen";
    }
}

public class Investigator extends Player
{
    public function Investigator(name_:String)
    {
        alignment = 1;
    }

    override public function action(target:Player)
    {
        target.revealed = true;
    }

    override public function describe():String
    {
        return "Cop";
    }
}

public class Doctor extends Player
{
    public function Doctor(name_:String)
    {
        alignment = 1;
    }

    override public function action(target:Player)
    {
        target.healed = true;
    }

    override public function describe():String
    {
        return "Doctor";
    }
}

public class Mafioso extends Player
{
    public function Mafioso(name_:String)
    {
        alignment = -1;
    }

    override public function action(target:Player)
    {
        target.attacked = true;
    }

    override public function describe():String
    {
        return "Mafia";
    }
}
}

And the code which creates the instance:

import Players;

stop();

var totalplayers:Number;
var playerArray:Array = new Array();
var playerType:Array = ["Citizen","Cop","Doctor","Mafia"];

var test:Citizen = new Citizen("James");

Both are in the same folder. I get the error code 1046 described in the title but I honestly have no idea why, flash picks it up in the code hints yet it comes up with that! Any help would be appreciated.

Also secondary question, I’ll never initiate the Player class (except through inheritance with the other classes), so can I make it private?

Thanks

  • 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-07T15:49:22+00:00Added an answer on June 7, 2026 at 3:49 pm

    I’m assuming all that code is in a file called Players.as.

    This is wrong. Each file should contain one class and the class should be the same name as the .as file.

    You currently have two classes (Player and Citizen) within one file.

    What you need to do is take the Player class you’ve defined and place it in its own .as. file with the same name (Player). Do the same for Citizen.

    Then you can use:

    import Player;
    import Citizen;
    

    Though this won’t be necessary because you don’t need to import classes that are in the same directory that you’re trying to access it from.

    As for the error, you’re getting that because Flash is trying to find the class Players and you don’t have a class with that name (just a file with that name).

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into

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.