Hello,
I am coding a game with an inventory and I am using addChild to move the item clicked into the inventory. This works fine, however when I move forward on the time line and then return back to the previous frame, the item remains where it was in addition to being in the inventory. My understanding is that the addChild method automatically removes the child from the stage when it puts it into another MC, however this is not what's happening. I've tried removeChild but since the child has initially been removed, it throws up an error message. Here's code for the function triggered by the eventListener:
Code:
function toInventory(event:MouseEvent):void {

inventory_mc.addChild(desertflower_mc);
trace("Flower goes to Inventory");
desertflower_mc.x = 400;
desertflower_mc.y = 290;
desertflower_mc.removeEventListener(MouseEvent.MOUSE_DOWN, toInventory);

How can I ensure that once the item is in the inventory, when I return to the frame where it was before it will no longer be there?

Thanks in advance!