|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
Flash8.0是Macromedia公司在7.0版本的基础上开发的,功能更强大,易于设计。
比来在制造flash时必要制造一个能够随便设定宽度的按钮组件.为了包管按钮款式稳定形,一样平常城市接纳将按钮分红几个mc的办法来制造.但实在,假如对按钮的静态效果请求未几的话,完整可使用Bitmap类来制造.上面是将按钮的一个形态分化开来.一样平常的思绪是做为三个MC,然后在改动宽度是,静态改动两头mc的宽度就能够了。可是如许的话,关于元素的制造就对照贫苦.利用bitmap类能够间接将一张图片分为三个MC后天生.在批量利用时,效力进步了很多.
办法:
/**
*date:2007.2.6
*author:Frank
*site:http://www.2solo.net/log
*/
importflash.display.*;
importflash.geom.Rectangle;
importflash.geom.Point;
install_img("mT_over_bmp",200,158,5,bmp_mc);
functioninstall_img(image_url,center_width,face_width,bar_left,tar_mc){
//image_url:方针图片路径
//center_width:全体宽度
//face_width:初始位图宽度
//bar_left:边侧mc宽度
//tar_mc:所要加载的容器地点
///界说原始
varlinkageId:String=image_url;
varmyBD:BitmapData=BitmapData.loadBitmap(linkageId);
if(tar_mc==undefined||tar_mc==""){
tar_mc=this;
}
//bmp_mc.attachBitmap(myBD,this.getNextHighestDepth());
face_width=face_width-2*bar_left;
///新建MC
tar_mc.center_mc.removeMovieClip();
tar_mc.left_mc.removeMovieClip();
tar_mc.right_mc.removeMovieClip();
varcenter_mc:MovieClip=tar_mc.createEmptyMovieClip("center_mc",tar_mc.getNextHighestDepth());
varleft_mc:MovieClip=tar_mc.createEmptyMovieClip("left_mc",tar_mc.getNextHighestDepth());
varright_mc:MovieClip=tar_mc.createEmptyMovieClip("right_mc",tar_mc.getNextHighestDepth());
center_mc._x=bar_left;
left_mc._x=0;
right_mc._x=center_width-bar_left;
///新建图片数据
varmyBD_C:BitmapData=newBitmapData(face_width,myBD.height,true,0x00FF0000);
varmyBD_L:BitmapData=newBitmapData(bar_left,myBD.height,true,0x00FF0000);
varmyBD_R:BitmapData=newBitmapData(bar_left,myBD.height,true,0x00FF0000);
///拷贝图片
myBD_C.copyPixels(myBD,newRectangle(bar_left,0,face_width,myBD.height),newPoint(0,0));
myBD_L.copyPixels(myBD,newRectangle(0,0,bar_left,myBD.height),newPoint(0,0));
myBD_R.copyPixels(myBD,newRectangle(myBD.width-bar_left,0,bar_left,myBD.height),newPoint(0,0));
//加载图片
center_mc.attachBitmap(myBD_C,this.getNextHighestDepth());
left_mc.attachBitmap(myBD_L,this.getNextHighestDepth());
right_mc.attachBitmap(myBD_R,this.getNextHighestDepth());
///调剂间隔
center_mc._width=center_width-2*bar_left;
}
stop();
flash动画制作软件的界面没有太大的改变,只是在以前的属性面板右侧增加了两个新的选项“参数”和“滤镜”。 |
|