TransformToolControl.as

package com.senocular.display {
    
    import flash.display.InteractiveObject;
    import flash.display.MovieClip;
    import flash.geom.Matrix;
    import flash.geom.Point;
    
    
public  class TransformToolControl extends MovieClip {
        
        
//  Variables
        protected var _transformTool:TransformTool;
        protected var _referencePoint:Point;
        protected var _relatedObject:InteractiveObject;
            
        
//  Properties
        
        
/**
         
*  Reference  to  TransformTool instance using the control
         
*  This  property   is  defined after using TransformTool.addControl
         
*  prior  to  being added  to  the TransformTool display list
         
*  (it can be accessed after the TransformTool.CONTROL_INIT event)
         
*/
        
public   function   get  transformTool():TransformTool {
            return _transformTool;
        }
        
public   function   set  transformTool(t:TransformTool):void {
            _transformTool 
=  t;
        }
        
        
/**
         
*  The  object   " related "   to  this control  and  can be referenced
         
*   if  the control needs association  with  another  object .  This  is
         
*  used  with  the default move control  to  relate itself  with  the
         
*  tool target (cursors also check  for  this)
         
*/
        
public   function   get  relatedObject():InteractiveObject {
            return _relatedObject;
        }
        
public   function   set  relatedObject(i:InteractiveObject):void {
            _relatedObject 
=  i ? i : this;
        }
        
        
/**
         
*  A point of reference that can be used  to  handle transformations
         
*  A TransformTool instance will use this  property   for  offsetting the
         
*  location of the mouse  to  match the desired start location of the transform
         
*/
        
public   function   get  referencePoint():Point {
            return _referencePoint;
        }
        
public   function   set  referencePoint(p:Point):void {
            _referencePoint 
=  p;
        }
        
        
/**
         
*  Constructor
         
*/
        
public   function  TransformToolControl() {
            _relatedObject 
=  this;
        }
        
        
/**
         
*  Optionally used  with  transformTool.maintainHandleForm  to  
         
*  counter transformations applied  to  a control by its parents
         
*/
        
public   function  counterTransform():void {
            transform.matrix 
=   new  Matrix();
            var concatMatrix:Matrix 
=  transform.concatenatedMatrix;
            concatMatrix.invert();
            transform.matrix 
=  concatMatrix;
        }
    }
}

转载于:https://www.cnblogs.com/ddw1997/archive/2009/10/09/1579921.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值