# When you change the image of a mc, why doesn't it inherit all the variables?

**URL:** <https://forum.kirupa.com/t/when-you-change-the-image-of-a-mc-why-doesnt-it-inherit-all-the-variables/282260>\
**Category:** Uncategorized\
**Created:** [February 19, 2009, 2:05pm UTC](https://forum.kirupa.com/t/when-you-change-the-image-of-a-mc-why-doesnt-it-inherit-all-the-variables/282260 "2009-02-19T14:05:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gzzle](https://avatars.discourse-cdn.com/v4/letter/g/8c91f0/32.png) [@gzzle](https://forum.kirupa.com/u/gzzle)\
**Post date:** [February 19, 2009, 2:05pm UTC](https://forum.kirupa.com/t/when-you-change-the-image-of-a-mc-why-doesnt-it-inherit-all-the-variables/282260/1 "2009-02-19T14:05:13Z")

</div>

Hola!

I’ve got a bunch of mc’s which I’ve put in an array. With these mc’s you can do a lot of different things, like dragdrop and rotation. I also got a button which on mouse down, changes the image of the mc. It only changes the image… not the size. So far so good…

But when I’ve clicked the button and the mc’s all change their image… They are not able to dragdrop / rotation anymore. I do not understand why this is happening… because by clicking that button… it doesn’t change the names of the mc’s…

```
 ActionScript Code:
 [LEFT]

```

library = new mc\_library();  
library.x = 100;  
library.y = 100;  
addChild(library);

hamer = new mc\_hamer();  
hamer.state = “state1”;  
hamer.x = 110;  
hamer.y = 110;  
hamer.buttonMode = true;  
hamer.tooltip = “Hamer”;  
library.addChild(hamer);  
hamer.addEventListener(MouseEvent.MOUSE\_DOWN, function(evt:MouseEvent) {drag(event, hamer)});  
hamer.addEventListener(MouseEvent.MOUSE\_OVER, function(evt:MouseEvent) {onMouseOver(event, hamer)});  
gereedschap.push(hamer);

weergave.label = “weergave”;  
weergave.x = 200;  
weergave.y = 510;  
weergave.setStyle(“textFormat”, myFormat);  
addChild(weergave);  
weergave.addEventListener(MouseEvent.MOUSE\_DOWN, wisselWeergave);

private function wisselWeergave(event:MouseEvent):void  
{  
if (hamer.state == “state1”)  
{  
library.removeChild(hamer);  
hamer = new mc\_hamer\_2();  
library.addChild(hamer);  
hamer.state = “state2”;  
gereedschap.push(hamer);  
trace (hamer.state);  
}  
else if (hamer.state == “state2”)  
{  
library.removeChild(hamer);  
hamer = new mc\_hamer();  
library.addChild(hamer);  
hamer.state = “state1”;  
gereedschap.push(hamer);  
trace (hamer.state);  
}  
}

[/LEFT]

[LEFT]  
[/LEFT]

[COLOR=#000000]  
[/COLOR]anybody who knows what I’m doing wrong???
