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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:22:43+00:00 2026-05-27T19:22:43+00:00

I need to get access to a variable from another class and I keep

  • 0

I need to get access to a variable from another class and I keep getting error ‘1119: Access of possibly undefined property enemyList through a reference with static type Class.’ I can’t see what I do wrong since my variable is made ‘public’ and ‘static’.

class where the variable is made.

package classes.enemy
{   
imports ...

public class Enemy extends MovieClip
{
    public static var enemyList:Array = new Array(); **
    var speed:Number;

    public function initialize()
    {
        var stageReff:Stage = this.stage as Stage;
        addEventListener("enterFrame", enterFrame);
    }

    public function Enemy() 
    {
        enemyList.push(this); **
        this.x = 700;
        this.y = Math.random()*200 + 50;
        speed = Math.random()*5 + 5;
    }

    //code
}
}

class that needs access to the variable

package classes.ship 
{
imports ...

public class Bullet extends MovieClip
{
    var speed:Number;

    public function initialize()
    {
        var stageReff:Stage = this.stage as Stage;
        stage.addEventListener("enterFrame", enterFrame);
    }

    //code

    function enterFrame(e:Event):void
    {
        this.x += speed;

        trace(enemy.enemyList); **
    }
}   
}

Putted ‘**’ behind the lines where the problem occurs and where the variable is made, just to make it clear.

Classes are in different folders (classes > enemy & classes > ship), don’t know if that has anything to do with it.

Thanks in advance.

  • 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-27T19:22:44+00:00Added an answer on May 27, 2026 at 7:22 pm

    If you want to access a static property, you need to use the class it is defined in: Enemy.enemyList

    Also make sure the class is imported properly in your ship’s class: import classes.enemy.Enemy;

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

Sidebar

Related Questions

I need to acces a variable (an int) from another class file. How would
I need to access the config variables from inside another class of a module.
i need to get access from native code (C++) to a java vertex array
I need to pass a variable from Admin.java file to index.jsp. I get the
I need to get access to the iTunes tags in an RSS feed using
I need to get a log of user access to our SQL Server so
So I am trying to access a jquery soundmanager variable from one script (wpaudio.js
I'm developing an application and I need to get the current date from a
If I try to access this system variable from the Run... dialog, Windows tells
I want my function to access an outside variable—from its parent function specifically. However,

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.