I am relatively new to Actionscript 3.0 and Flash CS3 for that matter, and am trying a new project. I have looked through this forum, but haven’t found a similar post (maybe searched wrong).
I have an issue where I have an instance of a movie clip and the movie clip has multiple layers so that I can dynamically change the color of one part of the movie clip.
I can copy the movie clip which works fine, but when I try to drag the new instance, one layer moves while the other doesn’t, and then if I drag the layer that was left behind, it moves both layers (the first moved one now in its new position moves along relative to the second dragged part). I would like to have this new instance act as a whole movie clip to drag around.
It may be hard for me to explain properly so I included the .fla (which shows the movie clip I am trying to drag) and the code.
var colorTransform:ColorTransform = newCircle.transform.colorTransform;
var addedCircle_mc:MovieClip;
function colorChange(event:MouseEvent){
colorTransform.color = 0x00ff00;
newCircle.insideBack.transform.colorTransform = colorTransform;
}
color_btn.addEventListener(MouseEvent.CLICK, colorChange);
copy_btn.addEventListener(MouseEvent.CLICK, duplicateClickHandler);
function duplicateClickHandler(event:MouseEvent){
addedCircle_mc = new Circle();
addedCircle_mc.height = newCircle.height;
addedCircle_mc.width = newCircle.width;
addedCircle_mc.insideBack.transform = newCircle.insideBack.transform;
addedCircle_mc.transform = newCircle.transform;
addChild(addedCircle_mc);
addedCircle_mc.x += 125;
addedCircle_mc.addEventListener(MouseEvent.MOUSE_DOWN,myObjDrag);
addedCircle_mc.addEventListener(MouseEvent.MOUSE_UP,myObjStop);
addedCircle_mc.addEventListener(MouseEvent.ROLL_OUT,myObjStop);
}
function myObjDrag(event:Event){
event.target.startDrag(false);
event.target.parent.addChild(event.target);
}
function myObjStop(event:Event){
event.target.stopDrag();
}
Any help to get this movie clip “whole again” would be greatly appreciated.