# Attempted Access of inaccessible method

**URL:** <https://forum.kirupa.com/t/attempted-access-of-inaccessible-method/318337>\
**Category:** flash\
**Created:** [January 17, 2011, 4:24pm UTC](https://forum.kirupa.com/t/attempted-access-of-inaccessible-method/318337 "2011-01-17T16:24:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wikiemol](https://avatars.discourse-cdn.com/v4/letter/w/eb9ed0/32.png) [@wikiemol](https://forum.kirupa.com/u/wikiemol)\
**Post date:** [January 17, 2011, 4:24pm UTC](https://forum.kirupa.com/t/attempted-access-of-inaccessible-method/318337/1 "2011-01-17T16:24:27Z")

</div>

I am trying to write a simple code that makes a movieclip bounce around the stage, yet every time I test the movie it gives me this error:

_1195: Attempted access of inaccessible method stageWidth through reference of static type flash.display:Stage_

I have two classes, one called mover which looks like this:

\*package {  
import flash.display.MovieClip;  
import flash.events.Event;

```
public class Mover extends MovieClip{
	public var targetMC:MovieClip;
	public var xVel:Number;
	public var yVel:Number;

	function Mover(targetMC:MovieClip, xVel:Number, yVel:Number) {
		this.targetMC = targetMC
		this.xVel = xVel;
		this.yVel = yVel;
	}
	function updatePosition(evtObj:Event):void {
		this.targetMC.x += this.xVel;
		this.targetMC.y += this.yVel;
	}
	public function startMoving():void {
		this.targetMC.addEventListener(Event.ENTER_FRAME, this.updatePosition);
	}
	public function stopMoving():void {
		this.targetMC.removeEventListener(Event.ENTER_FRAME, this.updatePosition);
	}

}

```

}\*

and another called Bouncer, which looks like this:

\*package {  
import flash.display.MovieClip  
import Mover;  
import flash.events.Event;

```
public class Bouncer extends Mover{

	public function Bouncer(targetMC:MovieClip, xVel:Number, yVel:Number) {
		super(targetMC,xVel,yVel);
		
	}
	private function bounceAtBorder():void {
		if (this.targetMC.x &gt; this.targetMC.stage.stageWidth(this.targetMC.width/2)) {
			trace("Bounce at right edge");
			this.targetMC.x = this.targetMC.stage.stageWidth(this.targetMC.width/2);
			this.xVel *= -1;
		}
		if (this.targetMC.y &gt; this.targetMC.stage.stageHeight(this.targetMC.height/2)){
			trace("Bounce at bottom edge");
			this.targetMC.y = this.targetMC.stage.stageHeight(this.targetMC.height/2);
			this.yVel*=-1
		}
		if(this.targetMC.x &lt; this.targetMC.width/2) {
			trace("Bounce at left edge");
			this.targetMC.x = this.targetMC.width/2;
			this.xVel *= -1
		}
		if (this.targetMC.y &lt; this.targetMC.height/2) {
			trace ("Bounce at top edge");
			this.targetMC.y = this.targetMC.height/2;
			this.yVel *= - 1;
		}
	}
	override function updatePosition(evtObj:Event):void {
		super.updatePosition(evtObj);
		this.bounceAtBorder();
	}

}

```

}  
\*

What do I need to do to fix this?
