![](http://hi.csdn.net/attachment/201109/14/0_13159895689Q7a.gif)
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);
}
}