# Determine the x and y value of an object on the stage

**URL:** <https://forum.kirupa.com/t/determine-the-x-and-y-value-of-an-object-on-the-stage/306534>\
**Category:** Uncategorized\
**Created:** [March 17, 2010, 4:57am UTC](https://forum.kirupa.com/t/determine-the-x-and-y-value-of-an-object-on-the-stage/306534 "2010-03-17T04:57:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nlween](https://avatars.discourse-cdn.com/v4/letter/n/ac91a4/32.png) [@nlween](https://forum.kirupa.com/u/nlween)\
**Post date:** [March 17, 2010, 4:57am UTC](https://forum.kirupa.com/t/determine-the-x-and-y-value-of-an-object-on-the-stage/306534/1 "2010-03-17T04:57:47Z")

</div>

i have a class called “Ball” that extends “AllSprites” which is a class that extends “Sprite”. there is an addChild within the “Ball” class that adds a Sprite to the stage. when i run it like this, it successfully adds the object to the stage.

in my Main class i have

```auto
var ballOne:Ball = new Ball();

```

i am trying to get the x and y value of ballOne from within my Main class but if i try to do

```auto
trace(ballOne.x);

```

i get an error:

1119: Access of possibly undefined property x through a reference with static type Ball.

how do i tell my code that the ballOne is a Sprite so i can get the x and y values?

also not working:

```auto
trace(Sprite(ballOne.x));

```
