# Adding custom class to object

**URL:** https://forum.kirupa.com/t/adding-custom-class-to-object/249200
**Category:** flash
**Created:** [January 16, 2008, 1:39pm UTC](https://forum.kirupa.com/t/adding-custom-class-to-object/249200 "2008-01-16T13:39:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Josflos](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Josflos](https://forum.kirupa.com/u/Josflos)
#### Post date: [January 16, 2008, 1:39pm UTC](https://forum.kirupa.com/t/adding-custom-class-to-object/249200/1 "2008-01-16T13:39:42Z")

</div>

Hey,

For the game I am making, I’m using a self-made sprite managing system.  
I’ve got three classes: SpritesManager, SpriteGroup extends Movieclip and Sprite extends Movieclip.  
The idea is: SpritesManager is holding an object: “mainSprites”, SpritesManager also has  
a method “newGroup”, wich creates a new SpriteGroup in mainSprites.  
In this way I want to make a system for creating and managing some sort of Movieclip-tree.  
For example: mainSprites.enemies.badEnemy

The method newGroup in SpritesManager has a param “name” wich is the name of the SpriteGroup to create.  
Here’s where I’m stuck: how do I create a new SpriteGroup referenced to as “name” in mainSprites? :puzzle:

Maybe a stupid question, but this is my first attempt at writing classes.

Thx, Josflos
