Okey. the title is not as describing as it should be.
What I want to do now is to “crop” a movieclip that has several moviclips placed inside… Meaning I want to move all moviclips so that their placed up in the corner of the main movieclip. x=0 , y=0. and I want to do this programaticly. (the movieclips must have the same placements between theme…)
are there a quick and easy way to do this?
http://home.no.net/thor918/cropped_moviclip.fla
If anything is unclear please ask :to:
and thank you all for your help!
Edit,Edit:
Here are some work in progress
finding the x and y that I want to crop from.
finaly something that works. but since I want the change the visabilitys later on some of the movieclips, that it would be best to revert the changes from the crop and then crop again. hmm how do one do that the easiest way? I’m thinking loud here that perhaps I have to loop trough all objects and save the old x,y cordinates before I crop.
public function cropme():void{
import flash.display.DisplayObject ;
var LowestY:Number = this.FindLowestY();
var LowestX:Number = this.FindLowestX();
var childMovieClip:DisplayObject;
var i:int = this.numChildren;
while(i--) {
childMovieClip = this.getChildAt(i);
if (childMovieClip is MovieClip){
trace(childMovieClip.name);
if (childMovieClip.visible){
childMovieClip.y = childMovieClip.y - LowestY;
childMovieClip.x = childMovieClip.x - LowestX;
}
}
}
}
public function FindLowestY():Number{
import flash.display.DisplayObject ;
var VFindTopY:Number= 3600;
var childMovieClip:DisplayObject;
var i:int = this.numChildren;
while(i--) {
childMovieClip = this.getChildAt(i);
if (childMovieClip is MovieClip){
trace(childMovieClip.name);
if (childMovieClip.visible){
if (VFindTopY>childMovieClip.y){
VFindTopY = childMovieClip.y;
}
}
}
}
return VFindTopY;
}
public function FindLowestX():Number{
import flash.display.DisplayObject ;
var VFindLeftx:Number= 3600;
var childMovieClip:DisplayObject;
var i:int = this.numChildren;
while(i--) {
childMovieClip = this.getChildAt(i);
if (childMovieClip is MovieClip){
trace(childMovieClip.name);
if (childMovieClip.visible){
if (VFindLeftx>childMovieClip.x){
VFindLeftx = childMovieClip.x;
}
}
}
}
return VFindLeftx;
}