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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:25:41+00:00 2026-05-13T08:25:41+00:00

I am trying to override a parent class method. I successfully done so. But

  • 0

I am trying to override a parent class method. I successfully done so. But when I try to access a property. i get the following error

1178: Attempted access of inaccessible property left through a reference with static type

This property is public and it is defined. below is my code

package com.objects {

import flash.display.MovieClip;
import flash.events.*;
import flash.display.Stage;
import flash.geom.Rectangle;


public class Brick extends MovieClip {

public var points:Number = 100;
public var bWidth:Number = 50;
public var bHeight:Number = 20;
private var left:Number;
private var right:Number;
private var top:Number;
private var bottom:Number;
public var ball:Ball;
private var lastDistance:Number;
private var engine:Engine;

public var hit:Boolean;


public function Brick():void
{
stop();
addEventListener(Event.ENTER_FRAME, loop);
}

protected function loop(e:Event):void
{
updateArea();
checkBall();
}
protected function updateArea():void {
left = x;
right = x + bWidth;
top = y;
bottom = y + bHeight;
}

protected function killSelf():void {
engine.score += points;
engine.numberOfBricks -= 1;
removeEventListener(Event.ENTER_FRAME,loop);
engine.removeChild(this);
}

protected function checkBall():void
{
if(hitTestObject(ball))
{

if((ball.x + 5) < left)
{
ball.xspeed *= -1;
ball.x -= ball.xspeed + 10;
killSelf();
}
else if((ball.x - 5) > right)
{
ball.xspeed *= -1;
ball.x += ball.xspeed+10;
killSelf();
}

else if(ball.y > bottom && ball.x > left && ball.x < right)
{
ball.yspeed *= -1;
ball.y += ball.yspeed+10;
killSelf();

}
else if(ball.y < top && ball.x > left && ball.x < right)
{
ball.yspeed *= -1;
ball.y -= ball.yspeed+10;
killSelf();                 
}

}
}//End CheckBall

public function getEngine(engine:Engine):void
{
this.engine = engine;
}
public function getBall(ball:Ball):void
{
this.ball = ball;
}
}
} 

Here is the overriding class

package com.objects {

    import flash.display.MovieClip;
    import flash.events.*;
    import flash.display.Stage;
    import flash.geom.Rectangle;


    public class Brick2 extends Brick {

        private var armor:Number = 2;

        public function Brick2():void
        {
            gotoAndStop(2);
        }

        override protected function checkBall():void
        {
            if(hitTestObject(this.ball))
            {
                if(armor <=0){

                    if((this.ball.x + 5) < left)
                    {
                        this.ball.xspeed *= -1;
                        this.ball.x -= this.ball.xspeed + 10;
                        killSelf();
                    }
                    else if((this.ball.x - 5) > right)
                    {
                        this.ball.xspeed *= -1;
                        this.ball.x += this.ball.xspeed+10;
                        killSelf();
                    }

                    else if(this.ball.y > bottom && this.ball.x > left && this.ball.x < right)
                    {
                        this.ball.yspeed *= -1;
                        this.ball.y += this.ball.yspeed+10;
                        killSelf();

                    }
                    else if(this.ball.y < top && this.ball.x > left && this.ball.x < right)
                    {
                        this.ball.yspeed *= -1;
                        this.ball.y -= this.ball.yspeed+10;
                        killSelf();                 
                    }
                }//end armor condition
                else
                {
                    --armor
                }
            }
        }//End Checkthis.ball

    }
}
  • 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-13T08:25:41+00:00Added an answer on May 13, 2026 at 8:25 am

    In your base class, var left is declared as private. Trying to access it from elsewhere, including descendant classes will fail.

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

Sidebar

Related Questions

im trying to override the add() but it will not compile public class AVLTree<E
I've been trying to override the file login.xml but no matter what I try,
I'm trying to use a custom class to override a method in its super
While trying to get child class field getting parent field. In this example, when
I'm trying to override a method inside a jquery widget. The method can be
hi I am trying to get my arraylist value into my image adapter class
How does this child class access the parent class within livewallpaper service. public class
How can I go about making a child class override a privileged method of
I'm trying to create custom listview in android. When I try to access my
Trying to follow this MSDN tutorial to get a web response but not getting

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.