Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
retropunk

UI Buttons for TransformManager

Recommended Posts

Hi everyone, I am working a ui that can access the TransformManager.

So far this solution works well so I thought I would share it.

I'm also posting this to see if anyone has created a similar solution and if so maybe we could share ideas.

 

I welcome any constructive criticism or alternate solutions

 

Thanks

- Patrick

 

private function resetImageSize_click( event : MouseEvent ) : void
 {
  imgEditManager.selectItem( cropImageHolder );
  cropImageHolder.rotation = 0;
  cropImageHolder.width = originalSpriteInfo.width;
  cropImageHolder.height = originalSpriteInfo.height;
  cropImageHolder.x = originalSpriteInfo.x;
  cropImageHolder.y = originalSpriteInfo.y;
  imgEditManager.updateSelection();
 }
 // ====================
 // Zoom Increase Handlers
 // ====================
 private function zoomIncrease_mouseUp( event : MouseEvent ) : void
 {
  stage.removeEventListener(Event.ENTER_FRAME, zoomIncrease_onEnterFrame);
 }
 private function zoomIncrease_mouseDown( event : MouseEvent ) : void
 {
  stage.addEventListener(Event.ENTER_FRAME, zoomIncrease_onEnterFrame);
 }
 private function zoomIncrease_onEnterFrame( event : Event ) : void
 {
  imgEditManager.selectItem( cropImageHolder );
  imgEditManager.scaleSelection(1.01, 1.01);
 }

 // ====================
 // Zoom Decrease Handlers
 // ====================
 private function zoomDecrease_mouseUp( event : MouseEvent ) : void
 {
  stage.removeEventListener(Event.ENTER_FRAME, zoomDecrease_onEnterFrame);
 }
 private function zoomDecrease_mouseDown( event : MouseEvent ) : void
 {
  stage.addEventListener(Event.ENTER_FRAME, zoomDecrease_onEnterFrame);
 }
 private function zoomDecrease_onEnterFrame( event : Event ) : void
 {
  imgEditManager.selectItem( cropImageHolder );
  imgEditManager.scaleSelection(.99, .99);
 }

 // ====================
 // Rotate Right Handlers
 // ====================
 private function rotateRight_mouseDown( event : MouseEvent ) : void
 {
  stage.addEventListener(Event.ENTER_FRAME, rotateRight_onEnterFrame);
 }
 private function rotateRight_mouseUp( event : MouseEvent ) : void
 {
  stage.removeEventListener(Event.ENTER_FRAME, rotateRight_onEnterFrame);
 }
 private function rotateRight_onEnterFrame( event : Event ) : void
 {
  imgEditManager.selectItem( cropImageHolder );
  imgEditManager.rotateSelection(.01);
 }

 // ====================
 // Rotate Left Handlers
 // ====================
 private function rotateLeft_mouseDown( event : MouseEvent ) : void
 {
  stage.addEventListener(Event.ENTER_FRAME, rotateLeft_onEnterFrame);
 }
 private function rotateLeft_mouseUp( event : MouseEvent ) : void
 {
  stage.removeEventListener(Event.ENTER_FRAME, rotateLeft_onEnterFrame);
 }
 private function rotateLeft_onEnterFrame( event : Event ) : void
 {
  imgEditManager.selectItem( cropImageHolder );
  imgEditManager.rotateSelection(-.01);
 }

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.
×