Flash比较值水平翻转(ScaleX =-1)和垂直翻转(ScaleY=-1)

public class ImageScaleX extends Sprite{
		private var loader:Loader;
		public function ImageScaleX(){
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.stageFocusRect = false;
			loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
			loader.load(new URLRequest("image 1.png"), new LoaderContext(true,ApplicationDomain.currentDomain));
		}
		private function onComplete(e:Event):void{
			var image:Bitmap = Bitmap(loader.content);
			image.x =image.y=100;
			var bitmap:BitmapData = image.bitmapData;
			image.scaleX = -1;
			addChild(image);
		}
	}


1.当 image.x =image.y=100;image.scaleX = 1的时候

             

                        (100,100)

                                  --------------

                                  << image

                                  --------------

2..当 image.x =image.y=100;image.scaleX = -1的时候     

                         (100,100)

               --------------

                 image>>

               --------------

3.注意上面的坐标位置。如果要和1坐标一样,则加上宽度。要和2一样,则要image.x = 100-image.width;

   image.x = 100+image.width;

   image.y=100;

  var bitmap:BitmapData = image.bitmapData;

  image.scaleX = -1;

                          (100,100)

                                   --------------

                                   image>>

                                   --------------

 

public class ImageScaleX extends Sprite{
		private var loader:Loader;
		private var offsetX:int=-36
		private var offsetY:int=90 
		public function ImageScaleX(){
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.stageFocusRect = false;
			loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
			loader.load(new URLRequest("image 1.png"), new LoaderContext(true,ApplicationDomain.currentDomain));
		}
		
		private function onComplete(e:Event):void{
			var image:Bitmap = Bitmap(loader.content);
			var bitmap:BitmapData = image.bitmapData;
			/*image.scaleX = -1;
			image.x =-offsetX*/
				
			image.x =offsetX
		    image.y=offsetY;
			addChild(image);
		}
	}

 

 

   

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值