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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:26:21+00:00 2026-05-20T23:26:21+00:00

I have movie clip in an array (newStep) that is being added to the

  • 0

I have movie clip in an array (newStep) that is being added to the stage dynamically. It’s randomly choosing a frame to go to every time an instance is added. There is a nested movie clip (stepLine) that i need to change the alpha of. This code actually works for adding a string to to the dynamic text box (pointsDText) but when i try to access the nested movie clip (stepLine) it gives me 1009 null object reference error. The funny thing is the code actually works and does change the alpha of the movie clip but i still get that error, and i think it’s making my game more glitchy. I’ve tried using if(contains(steps[r].stepLine)) too but it doesn’t work. Is there a better way to access this movie clip without getting the error?

if(newStep != null){
    for(var r:int = 0; r<steps.length;r++){
        if(steps[r].currentLabel == "points"){
            steps[r].pointsDText.text = String(hPoints);
        }
        if(steps[r].currentLabel == "special"){
            steps[r].stepLine.alpha = sStepAlpha;   
        }
        if(steps[r].currentLabel == "life"){
            steps[r].stepLine.alpha = hStepAlpha;
        }
    }
}

This is so difficult to explain but i hope you understand.

Thanks so much.

  • 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-20T23:26:22+00:00Added an answer on May 20, 2026 at 11:26 pm

    A null reference error happens when you try to access properties of a variable that doesn’t point to any object — a null reference. You’re effectively trying to access an object that doesn’t exist. For example, perhaps stepLine doesn’t exist in one of those instances, so stepLine.alpha is causing the error. (How do you set the alpha of a non-existent clip?) Maybe the steps[r] clip is on a frame where there is not yet any stepLine MovieClip.

    You should run the movie in debug mode by pressing Ctrl+Shift+Enter in the Flash IDE. This should show you the exact line that causes the error, and it will let you inspect the values of any variables at that point. This should help you track down the problem. Similarly, you can use trace statements to aid in debugging. For example, you could trace(steps[r].stepLine); to check for null values, or even simply if(!steps[r].stepLine) trace("ERROR");. Additionally, if you wrap your accesses in if statements, you can avoid the null reference errors, even though this doesn’t really address the underlying problem:

    if(newStep != null){
        for(var r:int = 0; r<steps.length;r++){
            // only touch things if the movieclip actually exists
            if(steps[r] && steps[r].stepLine){
                if(steps[r].currentLabel == "points"){
                    steps[r].pointsDText.text = String(hPoints);
                }
                if(steps[r].currentLabel == "special"){
                    steps[r].stepLine.alpha = sStepAlpha;   
                }
                if(steps[r].currentLabel == "life"){
                    steps[r].stepLine.alpha = hStepAlpha;
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having some trouble getting the syntax right. I have a movie clip that
I have a mainMovie clip that consist of different movie clips. Inside of my
I have a custom class that embeds a movie clip. When I try to
I have a movie clip that consists of a button and two labels (both
So, I'm building stuff in AS3, I have a main movie clip, and I
My stage have 3 movieclip that is mc1,mc2 and mc3. each of them are
I have a movie clip who is only a square, i need to copy
I have a movie clip object with a width of 306 and height of
Inside my Document Class I have assign to an array some objects that are
Currently I have an Array that is having 9 buttons pushed to it. 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.