FLEX Image: 显示指定的图片范围, 而非缩放图片

 image

 

image

第一副图截取该图片靠左上的500*65

第二幅图则将图片转换为500*65

Image的scaleContent默认为true,将其置为false, 则实现第一附图的效果.

	private function setImgVisable(visable:Boolean, source:String=null):void {
		_imgBanner.visible = visable;
		if(visable) {
			_imgBanner.scaleContent = false;
			_imgBanner.explicitHeight = IMG_HEIGHT;
			_imgBanner.explicitWidth = IMG_WEIHT;
			_imgBanner.source = source;
		}else {
			_imgBanner.explicitHeight = 0;
			_imgBanner.explicitWidth = 0;
			_imgBanner.source = null;
		}
	}
This entry was posted in Flex and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>