Flex裁剪图片

关于CSS裁剪图片参考->http://lpyyn.iteye.com/admin/blogs/2066496

Flex中引用图片的方式:

1.多个图片文件封装到swf中,使用Embed元数据标签声明图片引用的Class属性。具体操作参考附件“[Embed]标签嵌入外部资源  .rar”。

2.分别使用Embed标签嵌入单个图片文件。引用的方式和方式1一样,这是引用的图片文件是单个的图片文件。

3.直接在Imag标签中使用Embed引入图片、指定图片的路径、使用图片的bitmap对象。如下:

4.在flex中根据指定的位置(x、y)、裁剪图片宽度和高度裁剪图片。这种方式实现的效果类似于CSS样式对图片的裁剪。

裁剪图片类:

package com.imageSplit{
import flash.display.Bitmap;

public class ImageInfo{
	public function ImageInfo(source:Bitmap,width:Number,height:Number){
		this.source = source ;
		this.width = width ;
		this.height = height ;
	}
	[Bindable]
	public var source:Bitmap ;
	[Bindable]
	public var width:Number ;
	[Bindable]
	public var height:Number ;

}
}

裁剪图片配置文件:

<?xml version="1.0" ?>
<configuration>
	<srcImage source="com/markers_new.png">
		<!-- 在地图上结果标签 -->
		<image id="MAP_A" x="0" y="0" width="23" height="31"/>
		<image id="MAP_B" x="28" y="0" width="23" height="31"/>
		<image id="MAP_C" x="56" y="0" width="23" height="31"/>
		<image id="MAP_D" x="86" y="0" width="23" height="31"/>
		<image id="MAP_E" x="115" y="0" width="23" height="31"/>
		<image id="MAP_F" x="144" y="0" width="23" height="31"/>
		<image id="MAP_G" x="172" y="0" width="23" height="31"/>
		<image id="MAP_H" x="201" y="0" width="23" height="31
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值