# MM prototyping UIObject methods to MovieClip class, why!?!?

**URL:** https://forum.kirupa.com/t/mm-prototyping-uiobject-methods-to-movieclip-class-why/46236
**Category:** flash
**Created:** [March 22, 2004, 9:07pm UTC](https://forum.kirupa.com/t/mm-prototyping-uiobject-methods-to-movieclip-class-why/46236 "2004-03-22T21:07:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![craftymind](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@craftymind](https://forum.kirupa.com/u/craftymind)
#### Post date: [March 22, 2004, 9:07pm UTC](https://forum.kirupa.com/t/mm-prototyping-uiobject-methods-to-movieclip-class-why/46236/1 "2004-03-22T21:07:13Z")

</div>

How did this get by a code walk at MM? Did they outsource their component creation, cuase I’ve always been told MM was against prototyping built-in objects?

All, of these methods are obviously used on Movieclips inside the components, so I can’t figure out why they didn’t just extend the movieclips being used, instead of dirtying up every movieclip in a users movie.

class mx.core.ext.UIObjectExtensions

```auto

// add stuff to MovieClip
var mc:Object = MovieClip.prototype;
mc.getTopLevel = ui.getTopLevel;
mc.createLabel = ui.createLabel;
mc.createObject = ui.createObject;
mc.createClassObject = ui.createClassObject;
mc.createEmptyObject = ui.createEmptyObject;
mc.destroyObject = ui.destroyObject;

// add CSS style processing
mc. __getTextFormat = ui.__ getTextFormat;
mc._getTextFormat = ui._getTextFormat;
mc.getStyleName = ui.getStyleName;
mc.getStyle = ui.getStyle;

```

class mx.managers.DepthManager

```auto

// Only one depth manager is needed. When created it adds the methods to the
// base classes
function DepthManager()
{
		MovieClip.prototype.createClassChildAtDepth = createClassChildAtDepth;
		MovieClip.prototype.createChildAtDepth = createChildAtDepth;
		MovieClip.prototype.setDepthTo = setDepthTo;
		MovieClip.prototype.setDepthAbove = setDepthAbove;
		MovieClip.prototype.setDepthBelow = setDepthBelow;
		MovieClip.prototype.findNextAvailableDepth = findNextAvailableDepth;
		MovieClip.prototype.shuffleDepths = shuffleDepths;
		MovieClip.prototype.getDepthByFlag = getDepthByFlag;
		MovieClip.prototype.buildDepthTable = buildDepthTable;

		// applyDepthSpaceProtection();
}

```
