# Classes and addChild from MainTimeline

**URL:** https://forum.kirupa.com/t/classes-and-addchild-from-maintimeline/271584
**Category:** flash
**Created:** [September 25, 2008, 2:27am UTC](https://forum.kirupa.com/t/classes-and-addchild-from-maintimeline/271584 "2008-09-25T02:27:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![stickaforkinit](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@stickaforkinit](https://forum.kirupa.com/u/stickaforkinit)
#### Post date: [September 25, 2008, 2:27am UTC](https://forum.kirupa.com/t/classes-and-addchild-from-maintimeline/271584/1 "2008-09-25T02:27:21Z")

</div>

Customer.as extends MovieClip

```php
 
public function BuildCustomer(x1,i) {
   var customer:CustomerContainer=new CustomerContainer; // linkage of movieclip to attach
   addChild(customer);
   var tmp_frame:Number=Math.floor(Math.random() * customer.totalFrames);
   customer.gotoAndStop(tmp_frame);
   customer.name="mc_cust_"+i;
   customer.txt_count.text=String(sum_total);
   customer.x=x1+i*(customer.width+55);
   customer.y=200;
  }

```

Main File .fla timeline

```php

for (var i=0; i<5; i++) {
 var cust:Customer=new Customer(200,i);
 addChildAt(cust,i);
}

```

This works and outputs 5 customers on the stage…

How do I manipulate and call them from the main timeline  
say if I want to move customer 1 to an x position of 0

Thanks for the help. Slowly migrating to AS3 from 2…just so much faster to go with what you know…
