# mouseX in a class

**URL:** <https://forum.kirupa.com/t/mousex-in-a-class/296164>\
**Category:** flash\
**Created:** [September 10, 2009, 10:10am UTC](https://forum.kirupa.com/t/mousex-in-a-class/296164 "2009-09-10T10:10:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![werehunt](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@werehunt](https://forum.kirupa.com/u/werehunt)\
**Post date:** [September 10, 2009, 10:10am UTC](https://forum.kirupa.com/t/mousex-in-a-class/296164/1 "2009-09-10T10:10:22Z")

</div>

```auto

    _xPercent = mouseX / _stage.stageWidth;
    _yPercent = mouseY / _stage.stageHeight;

```

if I want to use mouseX and mouseY in my class whats the most effective way to do this?  
I know if I extend a class to Sprite for example I get this feature but could I get it with less…

I know I could say this also and then I wouldnt need to extend Sprite but I dont know if this is a good idea…

```auto

    _xPercent = _stage.mouseX / _stage.stageWidth;
    _yPercent = _stage.mouseY / _stage.stageHeight;

```
