# Using objects in Mx

**URL:** <https://forum.kirupa.com/t/using-objects-in-mx/71076>\
**Category:** flash\
**Created:** [November 20, 2004, 3:21pm UTC](https://forum.kirupa.com/t/using-objects-in-mx/71076 "2004-11-20T15:21:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [November 20, 2004, 3:21pm UTC](https://forum.kirupa.com/t/using-objects-in-mx/71076/1 "2004-11-20T15:21:50Z")

</div>

I have recently become aware that i need to structure code in a more organised fashion. Is there anything wrong with this way of storing/retrieving info within objects? Any potential problems/limitations?

```auto
//mc instance name mc
//mc instance name mc1
function Myclass(x, y, a) {
	this._x = x;
	this._y = y;
	this._alpha = a;
}

Myclass.prototype.onPress = function() {
	trace(this._name);
};
function Mysubclass(x, y, a, targetX, sc) {
	super(x, y, a);
	this._xscale = this._yscale=sc;
	this.targetX = targetX;
}
Mysubclass.prototype = new myclass();
Mysubclass.prototype.move = function() {
	this._x += (this.targetX-this._x)/5;
	if (Math.abs(this.targetX-this._x)<1) {
		this._x = this.targetX;
		delete this.onEnterFrame;
	}
};
Mysubclass.prototype.onRelease = function() {
	this.onEnterFrame = this.move;
};
mc.obj = new myclass(500, 400, 30);
mc1.obj = new mysubclass(200, 200, 50, 500, 50);
for (var prop in this) {
	if (typeof (this[prop]) == "movieclip" && this[prop].obj) {
		trace(this[prop].obj);
		for (var prop1 in this[prop].obj) {
			this[prop][prop1] = this[prop].obj[prop1];
		}
	}
}

```
