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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:40:54+00:00 2026-05-12T17:40:54+00:00

Hey guys, hoping for some help with this :( been stuck on it for

  • 0

Hey guys, hoping for some help with this 🙁 been stuck on it for a couple days now.

I’m creating a ScrollBar using Lee Brimelow’s ScrollBar class. I’ve had to modify it to work inside of my Class files and think I’m on the right track, but I’m getting the dreaded:

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

When I run debug, it hits on the line where I have rollerUp);

CODE FROM SCROLLBAR CLASS:

import flash.display.*;
import flash.events.*;
import caurina.transitions.*;

public class ScrollBar extends MovieClip
{
    private var yOffset:Number;
    private var yMin:Number;
    private var yMax:Number;
    private var thumbsnailTab:MovieClip;
    private var theRoller:MovieClip;

    public function ScrollBar(myRoller:MovieClip, myTrack:MovieClip, thumbsnails:MovieClip):void
    {
        yMin = 0;
        yMax = myTrack.height - myRoller.height;
        theRoller = myRoller;
        thumbsnailTab = thumbsnails;
        myRoller.addEventListener(MouseEvent.MOUSE_DOWN, rollerDown);
        stage.addEventListener(MouseEvent.MOUSE_UP, rollerUp);
    }

This is what my debug is showing me:

alt text

At first I wasn’t sure if it was the stage reference that is causing the error or the rollerUp function, but since I commented out the stage.removeEventListener and added a basic trace statement it still throws up an error so I believe it has something to do with:

stage.addEventListener(MouseEvent.MOUSE_UP, rollerUp);

Now I have imported events.*; to the ScrollBar class… maybe the problem is in my main class where I create the graphics for the ScrollBar as well as add the ScrollBar to the display list?

CODE FROM MAIN CLASS:

// Creating Graphics
        track1 = new Track;
        track1.x = 0;
        track1.y = 0;

        roller1 = new Roller;
        roller1.x = 0;
        roller1.y = 0;

        sc1 = new EmptyMov;
        sc1.x = 764;
        sc1.y = 470;

        sc1.addChild(track1);
        sc1.addChild(roller1);

// Adding ScrollBar to Stage
scroll1 = new ScrollBar(roller1, track1, tab1);
container.addChild(sc1);
container.addChild(scroll1);
addChild(container);

I’m stuck here, not sure why I’m getting that Null reference error, as well as not sure if I’m creating the graphics the right way as well as using the ScrollBar class correctly 🙁 any tips appreciated!

alt text


Update Code Working! 😀

public function ScrollBar(myRoller:MovieClip, myTrack:MovieClip, thumbsnails:MovieClip):void
    {
        yMin = 0;
        yMax = myTrack.height - myRoller.height;
        theRoller = myRoller;
        thumbsnailTab = thumbsnails;
        myRoller.addEventListener(MouseEvent.MOUSE_DOWN, rollerDown);
    }

    private function rollerDown(e:MouseEvent):void
    {
        stage.addEventListener(MouseEvent.MOUSE_UP, rollerUp);
        stage.addEventListener(MouseEvent.MOUSE_MOVE, rollerMove);
        yOffset = mouseY - theRoller.y;
    }

alt text

  • 1 1 Answer
  • 2 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-12T17:40:55+00:00Added an answer on May 12, 2026 at 5:40 pm

    I think your problem is that stage=null. The reason can by only one: you trying to get to stage, when the MC is not added to it (then the reference is null).

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

Sidebar

Related Questions

Hey guys, I've been bashing my head around for hours now, over this login
Hey right now I'm using jQuery and I have some global variables to hold
hey guys, how can I just achieve this simple layout? I'm hoping the answer
Hey guys, I've spent hours looking at this, and am hoping a fresh pair,
Hey guys, first time using stackoverflow. can you guys help me debug? Heres the
hey guys, I've followed some tutorials online regarding creating and installing a windows service
Hey peoples, I've been studying Java for a couple of weeks, and have decided
Hey guys, hope this isn't too much of a n00b question I'm mainly a
Hey im working on my first php site, and was hoping to get some
Hey guys - I know this is not a strictly programming question but I'm

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.