# Changing the x/y position of an instance from an external .as? (AS3)

**URL:** <https://forum.kirupa.com/t/changing-the-x-y-position-of-an-instance-from-an-external-as-as3/255319>\
**Category:** flash\
**Created:** [March 21, 2008, 2:44am UTC](https://forum.kirupa.com/t/changing-the-x-y-position-of-an-instance-from-an-external-as-as3/255319 "2008-03-21T02:44:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kidkreep](https://avatars.discourse-cdn.com/v4/letter/k/f0a364/32.png) [@kidkreep](https://forum.kirupa.com/u/kidkreep)\
**Post date:** [March 21, 2008, 2:44am UTC](https://forum.kirupa.com/t/changing-the-x-y-position-of-an-instance-from-an-external-as-as3/255319/1 "2008-03-21T02:44:40Z")

</div>

First post!

Been searching the boards/web for a couple days now looking for an answer to the following. Apologies if this has already been answered previously. And I’m new to ActionScripting in general, hence the lengthy explanation.

I have an .fla, DocumentClass.as, Ball.as and Buttons.as all in the same folder. The Document Class:

- Creates an instance of Buttons, gives it an x/y position and adds it to the stage

The Button Class: (assigned to a MC in my library)

- Has an event listener that listens for a mouse click
- When clicked, the button creates an instance of Ball, gives it an x/y position and adds it to the stage (instance name is \_ball)
- Then calls a function Go(); which is in the Ball class ( e.g., \_ball.Go(); )

The Ball Class: (assigned to a MC in my library)

- The Go(); function is called successfully from the button mentioned above (traces to the output panel)

THE PROBLEM

- I also want to Go(); function to update the position of the instance \_ball, but the instance isn’t recognized within the class Ball.

(if I try \_ball.x = 100 I get, 1119: Access of possibly undefined property ball through a reference with static type flash.display:Stage.)

How would one go about doing this?
