# Dabbling in classes

**URL:** https://forum.kirupa.com/t/dabbling-in-classes/319158
**Category:** Uncategorized
**Created:** [February 10, 2011, 12:54pm UTC](https://forum.kirupa.com/t/dabbling-in-classes/319158 "2011-02-10T12:54:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lnsiu](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@lnsiu](https://forum.kirupa.com/u/lnsiu)
#### Post date: [February 10, 2011, 12:54pm UTC](https://forum.kirupa.com/t/dabbling-in-classes/319158/1 "2011-02-10T12:54:59Z")

</div>

I must be doing this wrong!?  
I have two classes, for example: Main and BrowseForFile.

Main creates a new BrowseForFile and adds that object to the stage with addChild.

If I don’t addChild locally in the BrowseForFile class, nothing is added to stage.  
So addChild is done both in the Main and BrowseForFile. While it is nice to addChild locally in a class, this seems wrong?

Shouldn’t the new BrowseForFile() class be an object, returned to the Main class?  
so why do I have to addChild locally in the object?

Main class

```php
theFile = new BrowseFile();
addChild(theFile);

```

BrowseForFile class

```php
loader.loadBytes(evt.target.data);
addChild(loader);

```
