# Can properties be replace by variables?

**URL:** <https://forum.kirupa.com/t/can-properties-be-replace-by-variables/223185>\
**Category:** flash\
**Created:** [April 20, 2007, 5:24am UTC](https://forum.kirupa.com/t/can-properties-be-replace-by-variables/223185 "2007-04-20T05:24:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elihorn](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/elihorn/32/2458_2.png) [@elihorn](https://forum.kirupa.com/u/elihorn)\
**Post date:** [April 20, 2007, 5:24am UTC](https://forum.kirupa.com/t/can-properties-be-replace-by-variables/223185/1 "2007-04-20T05:24:53Z")

</div>

Hi there!  
What I am trying to do is write a class that could function on the x axis, or y axis, so when an instance of the class is called, the axis is specified. For example:

```auto
Scroll:ScrollFunction = new ScrollFunction(_x, MC);
class ScrollFunction {
function ScrollFunction(axis, targetMC) {
    targetMC.axis = 25;
}
}

```

That’s a very simplified version, but you get the idea. This won’t work though because although Flash recognizes ‘axis’ as being equal to ‘\_x’, it does not recognize ‘axis’ as a property.

All I want to know is if it is possible or not. I could, of course use an if statement, but that would mean I would have to have to write the function twice, once for each axis, which is what I want to avoid.

Any help is great! Thanks!
