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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:03:59+00:00 2026-06-07T20:03:59+00:00

I have an array in my main public var graphArray:Array = [1,2,3,4,5,6]; And I’m

  • 0

I have an array in my main

public var graphArray:Array = [1,2,3,4,5,6];

And I’m trying to access it from within a MovieClip that I’ve put on my timeline using:

var graph1scale:Number = MovieClip(root).graphArray[0]

It looks like it would make sense to me but when I try to run it I get this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

Am I wrong to be using MovieClip(root) to try and access it? I’ve only just started using external classes (this is my first project doing so) and usually I just do everything on the timeline. So MovieClip(root) is familiar to me but I guess it’s not the right thing to do here.

Is there a way I can access vars from Main.as?

—–SOLVED—–

I realised MovieClip(root) did work all along but I was just calling on the array before the array was being defined in Main.as. I put a delay on calling graphArray and it worked.

Not sure how that makes sense though because the graphArray is the first thing I’ve defined in the whole main.as class

  • 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-07T20:04:01+00:00Added an answer on June 7, 2026 at 8:04 pm

    Try using this instead

    MovieClip(this.root)
    

    This works for me on a test that you can see here:

    http://marksost.com/test/as3arrayaccess/

    And the source files here:

    http://marksost.com/test/as3arrayaccess/test.zip

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

Sidebar

Related Questions

I have created an array Man: public main blah blah{ man = man[10]; }
I have a two dimensional array public class TwoDimensions { public static void main(String[]
I have one main array which is the returned data from a MySQL query
I have a ListView in main.xml where android:entries=@array/list1 and I'd like to update that
I have a singleton class that inherits from sprite so that it can access
I have following goal: From a list in main activity that extends ListActivity, I
In my main file I have an array of character strings, char names[320][30], and
I have a scenario where i need to copy the array of Objects(Main array)
I am trying to pass an array of ints from C# to C++/CLI. Here's
Let's Say I Have This Class: package{ import flash.display.Sprite; public class Main extends Sprite{

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.