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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:22:30+00:00 2026-06-14T19:22:30+00:00

I have a component that has a bunch of components that if you click

  • 0

I have a component that has a bunch of components that if you click and drag on those components, they light up. And if you click and drag on those same components, they go back to their normal setting. (Also as they are clicked and unclicked, a percentage value is linked to show to the right of the components)

Now I am trying to create a “Reset” button that sets the percentage back to zero and unhighlights all the pieces previously selected. But I am getting a “error #1009 cannot access a property or method of a null object reference”, from my function (resetGVHD) at the bottom for the Reset button.

(Also, – showCaption is the function i use to make it highlight. hideCaption is the function used to unhighlight.)

Any help would be greatly appreciated!
Thanks!

Here is my code:

    public var holdingPiece:Boolean = false;
    public var holdingSelectedPiece:Boolean = false;
    [Bindable]
    public var numberBodyButtonSelected:Number = 0;


    protected function pieMouseDownHandler(event:MouseEvent):void
    {
        var bodyButton:BodyButton= event.currentTarget as BodyButton;
        if( bodyButton.selected ){

            holdingSelectedPiece = true;
            holdingPiece = false;

            bodyButton.hideCaption();
            if (bodyButton.includedinBody){
                numberBodyButtonSelected -= bodyButton.percentageValue;
                }

            }else{

                 holdingSelectedPiece = false;
                 holdingPiece = true;

                 bodyButton.showCaption();
                 if (bodyButton.includedinBody){

            numberBodyButtonSelected+=  bodyButton.percentageValue;
                }

            }

        stage.addEventListener( MouseEvent.MOUSE_UP, releasePiece );

        }

        protected function pieRollOver(event:MouseEvent):void
        {

            var myPie:BodyButton = event.currentTarget as BodyButton;

            if( holdingPiece ){

                if( !myPie.selected ){

                    myPie.showCaption();
                    if (myPie.includedinBody){
                        numberBodyButtonSelected+= myPie.percentageValue;
                    }
                }

            }else if( holdingSelectedPiece ){

                if( myPie.selected ) {

                    myPie.hideCaption();
                    if (myPie.includedinBody){
                numberBodyButtonSelected-= myPie.percentageValue;
                    }
                }

            }

        }


        protected function releasePiece( event:MouseEvent ):void
        {

        stage.removeEventListener( MouseEvent.MOUSE_UP, releasePiece );

            holdingPiece = false;
            holdingSelectedPiece = false;

        }

        public var bodyButton:BodyButton;
        protected function resetGVHD( event:MouseEvent ):void{

            numberBodyButtonSelected=0; 

            bodyButton.hideCaption();







        }
  • 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-14T19:22:31+00:00Added an answer on June 14, 2026 at 7:22 pm

    You are looking for something like this:

    public var holdingPiece:Boolean = false;
    public var holdingSelectedPiece:Boolean = false;
    [Bindable]
    public var numberBodyButtonSelected:Number = 0;
    
    private var selectedButtons:Array = [];
    
    protected function pieMouseDownHandler(event:MouseEvent):void
    {
        var bodyButton:BodyButton = event.currentTarget as BodyButton;
        if( bodyButton.selected ){
            holdingSelectedPiece = true;
            holdingPiece = false;
            bodyButton.hideCaption();
            if (bodyButton.includedinBody){
                numberBodyButtonSelected -= bodyButton.percentageValue;
            }
        }else{
            holdingSelectedPiece = false;
            holdingPiece = true;
            bodyButton.showCaption();
            if (bodyButton.includedinBody){
                selectedButtons.push( bodyButton ); // this might go outside the if (bodyButton.includedinBody) condition
                numberBodyButtonSelected+=  bodyButton.percentageValue;
            }
        }
        stage.addEventListener( MouseEvent.MOUSE_UP, releasePiece );
    }
    
    protected function pieRollOver(event:MouseEvent):void
    {
        var myPie:BodyButton = event.currentTarget as BodyButton;
        if( holdingPiece ){
            if( !myPie.selected ){
                myPie.showCaption();
                if (myPie.includedinBody){
                    selectedButtons.push( bodyButton ); // this might go outside the if (myPie.includedinBody) condition
                    numberBodyButtonSelected+= myPie.percentageValue;
                }
            }
        }else if( holdingSelectedPiece ){
            if( myPie.selected ) {
                myPie.hideCaption();
                if (myPie.includedinBody){
                    numberBodyButtonSelected-= myPie.percentageValue;
                }
            }
        }
    }
    
    protected function releasePiece( event:MouseEvent ):void{
        stage.removeEventListener( MouseEvent.MOUSE_UP, releasePiece );
        holdingPiece = false;
        holdingSelectedPiece = false;
    }
    
    protected function resetGVHD( event:MouseEvent ):void{
        numberBodyButtonSelected=0;
        for (var i:int = 0; i < selectedButtons.length; i++) {
            BodyButton(selectedButtons[i]).hideCaption();
        }
        selectedButtons = [];
    }
    

    Now the resetGVHD function will call the hideCaption function on all buttons, that are in the array… but im not sure, that it will work, too much code is missing.

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

Sidebar

Related Questions

I have a component that has a sub-component they both use a shared variable
A pretty normal case: We have a 'portlet' composite component that has two states:
I have a DataGrid component that displays a few columns of data. It has
In Tridion I have a page to which a component is attached that has
We have this software that has a webservices component. Now, the administrator of this
I have a rails app that has a private component and a public component.
I have a Django webapp that has both a front-end, web-accessible component and an
I have a project that has components in several different directories and would like
I have a system that has many components interacting with each other. It occured
I have a web application on ASP.NET (C#) that has some precompiled components. I've

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.