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

Categories: Flex; Tagged with: ; @ March 15th, 2009 10:15

 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;
		}
	}



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.