Jump to content
Search Community

Move All The Way To Back

tcoz test
Moderator Tag

Recommended Posts

Looking for a tested best practice (I'm on a very tight deadline, so hacking around with untried suggestions really isn't an option) to move the currently selected item all the way to the back of the Z order in the transform manager.

Link to comment
Share on other sites

  • 2 months later...

i always use something like this:

 

//method to move up depth

private function swapDepthsGO($e:MouseEvent) : void {

var atm:TransformManager = fooClip._tm; // my active TransformManager

var objectsLen:int = atm.targetObjects.length; // length of all items which are registered with the TransformManager

depthCounter = 0; // inits my depth counter

depthID = setInterval(moveSelectionDepth,5,atm,objectsLen,1); // starts changing the depth 1 = up || -1 = down

}

 

//method to move down depth

private function swapDepthsGU($e:MouseEvent) : void {

var atm:TransformManager = fooClip._tm; // my active TransformManager

var objectsLen:int = atm.targetObjects.length; // length of all items which are registered with the TransformManager

depthCounter = 0; // inits my depth counter

depthID = setInterval(moveSelectionDepth,5,atm,objectsLen,1); // starts changing the depth 1 = up || -1 = down

}

//

private function moveSelectionDepth($atm,$len:int,$direction:int=1):void{

if(++depthCounter>$len){

clearInterval(depthID);

}else {

if($direction==-1){

$atm.moveSelectionDepthDown();

}else{

$atm.moveSelectionDepthUp();

}

}

}

Link to comment
Share on other sites

  • 1 month later...

Interesting, I need to do this very thing. But what's not clear to me is this line:

var atm:TransformManager = fooClip._tm; // my active TransformManager

 

Which is your active transform manager? atm or fooClip._tm? My TM is called "myManager", so I tried

var atm:TransformManager = myManager;

 

But this gives an error:

1067: Implicit coercion of a value of type com.greensock.transform:FlexTransformManager to an unrelated type com.greensock.transform:TransformManager.

 

So I tried modifying the code as below. Also I didn't see any variable declarations for depthID or depthCounter, so I added two ints below as well. This throws an error when I assign it to a button and run it, same error.

 

 

private var depthID:int;
private var depthCounter:int;

//method to move up depth
private function swapDepthsGO($e:MouseEvent) : void {
var objectsLen:int = myManager.targetObjects.length; // length of all items which are registered with the TransformManager
depthCounter = 0; // inits my depth counter
depthID = setInterval(moveSelectionDepth,5,myManager,objectsLen,1); // starts changing the depth 1 = up || -1 = down 
}

//method to move down depth
private function swapDepthsGU($e:MouseEvent) : void {
var objectsLen:int = myManager.targetObjects.length; // length of all items which are registered with the TransformManager
depthCounter = 0; // inits my depth counter
depthID = setInterval(moveSelectionDepth,5,myManager,objectsLen,1); // starts changing the depth 1 = up || -1 = down 
}

private function moveSelectionDepth($atm:TransformManager,$len:int,$direction:int=1):void{
if(++depthCounter>$len){
	clearInterval(depthID);
}else {
	if($direction==-1){
		$atm.moveSelectionDepthDown();
	}else{
		$atm.moveSelectionDepthUp(); 
	}
}
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...