Does anyone happen to know how to go about reparenting a movie clip that is already on the stage? I can only seem to find how to reparent sprites or children that were added. I’m working on a paper doll sort of game for a class http://comps.raemazing.com/tubbyWOOT.swf you can sort of get an idea from it here. As of right now it’s just adding a new child. Even if someone could tell me how to go about removing an old child that would be great. I’m sure it’s probably something simples… This is the code I have, sorry it’s so messy:
package
{
import flash.events.MouseEvent;
import flash.filters.DropShadowFilter;
import flash.display.*;
import flash.events.Event;
public class Drag extends MovieClip
{
public var _targetPiece:*;
public var _origX:Number;
public var _origY:Number;
public var _origXScale:Number;
public var _origYScale:Number;
public var _targetPieceX:Number;
public var _targetPieceY:Number;
public function Drag()
{
this.addEventListener(MouseEvent.MOUSE_DOWN, dragMovie);
this.addEventListener(MouseEvent.MOUSE_UP, dropMovie);
this.buttonMode = true;
//this.addEventListener(MouseEvent.MOUSE_DOWN, createPiece);
}
/* function dragMovie(event:MouseEvent):void
{
if(event.target == MovieClip) return;
{
stage.addChild(this);
event.target.startDrag();
}
}
function dropMovie(event:MouseEvent):void
{
event.target.stopDrag();
}
} */
function createPiece(m:MouseEvent):void
{
_origX = this.x;
_origY = this.y;
this.addEventListener (MouseEvent.MOUSE_DOWN, dragMovie, false, 0, true);
this.addEventListener (MouseEvent.MOUSE_UP, dropMovie, false, 0, true);
}
function dragMovie(event:MouseEvent):void
{
stage.addChild(this);
event.currentTarget.startDrag();
this.filters = [new DropShadowFilter()];
}
function dropMovie(event:MouseEvent):void
{
event.currentTarget.stopDrag();
this.filters = [];
}
/*private function dragMovie(event:MouseEvent):void
{
this.startDrag();
this.filters = [new DropShadowFilter()];
this.parent.addChild(this);
}
private function dropMovie(event:MouseEvent):void
{
this.stopDrag();
this.filters = [];
}
public function disable():void
{
this.buttonMode = false;
this.removeEventListener(MouseEvent.MOUSE_DOWN, dragMovie);
this.removeEventListener(MouseEvent.MOUSE_UP, dropMovie);
}
*/
}
}