# Dynamically change object type?

**URL:** https://forum.kirupa.com/t/dynamically-change-object-type/291011
**Category:** flash
**Created:** [June 23, 2009, 6:48pm UTC](https://forum.kirupa.com/t/dynamically-change-object-type/291011 "2009-06-23T18:48:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bed718](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@bed718](https://forum.kirupa.com/u/bed718)
#### Post date: [June 23, 2009, 6:48pm UTC](https://forum.kirupa.com/t/dynamically-change-object-type/291011/1 "2009-06-23T18:48:47Z")

</div>

Ok… Let me try to explain what I’m after. Any help would be great (even some google search terms to try!)

-= Lets say I have two swfs: ‘parent.swf’ and ‘child.swf’ AND MyCustomObject.as that extends MovieClip  
-= In child.swf I have a MovieClip physically placed on stage (not using adddChild). Lets call it “ball\_mc”  
-= child.swf gets loaded into parent.swf

What I want:  
-= once child.swf is loaded I want to change ball\_mc from a ball\_mc:MovieClip to ball\_mc:MyCustomObject  
-= Then I want to be able to call ball\_mc.init() (init() would be a public function in MyCustomObject.as)

Why I want to do this:  
-= I dont want to import MyCustomObject.as directly into the child.swf. This is because there will be LOTS of child.swfs (child1.swf - childN.swf) If the .as is imported directly into each of these AND the MyCustomObject.as changes I have to re-publish ALL the child.swfs so that they publish with the new code… Right?

MAIN QUESTIONs:  
-= whats the best way to go about doing this?? I just want to be able to change the MyCustomObject.as and have the effects show up on all the child.swfs (but not have to re-publish them all…)

Any help woulf be great!  
-=b=-
