大家能不能帮我改一下这个代码,这是AS2.0,改成AS3的代码规范。
时间:2011-03-16
来源:互联网
function createRef(p_source:MovieClip) {
var bd:BitmapData = new BitmapData(p_source._width, p_source._height, true, 0);
var mtx:Matrix = new Matrix();
mtx.d = -1;
mtx.ty = bd.height;
bd.draw(p_source, mtx);
var width:Number = bd.width;
var height:Number = bd.height;
mtx = new Matrix();
mtx.createGradientBox(width, height, Math.PI/2, 0, 0);
var shape:MovieClip = createEmptyMovieClip("shape", getNextHighestDepth());
//进行线性填充
shape.beginGradientFill("linear", [0, 0], [60, 0], [0, 255], mtx);
shape.lineTo(width, 0);
shape.lineTo(width, height);
shape.lineTo(0, height);
shape.endFill();
shape._visible = false;
var mask_bd:BitmapData = new BitmapData(width, height, true, 0);
mask_bd.draw(shape);
bd.copyPixels(bd, bd.rectangle, new Point(0, 0), mask_bd, new Point(0, 0), false);
var refMC:MovieClip = createEmptyMovieClip("refMC", getNextHighestDepth());
refMC._x = p_source._x;
refMC._y = p_source._y+p_source._height;
refMC.attachBitmap(bd, 0, "Auto ", true);
}
包含的错误有:
1180: 调用的方法 createEmptyMovieClip 可能未定义。
1119: 访问可能未定义的属性 rectangle (通过 static 类型 flash.display:BitmapData 引用)。
1180: 调用的方法 createEmptyMovieClip 可能未定义。
1180: 调用的方法 getNextHighestDepth 可能未定义。
var bd:BitmapData = new BitmapData(p_source._width, p_source._height, true, 0);
var mtx:Matrix = new Matrix();
mtx.d = -1;
mtx.ty = bd.height;
bd.draw(p_source, mtx);
var width:Number = bd.width;
var height:Number = bd.height;
mtx = new Matrix();
mtx.createGradientBox(width, height, Math.PI/2, 0, 0);
var shape:MovieClip = createEmptyMovieClip("shape", getNextHighestDepth());
//进行线性填充
shape.beginGradientFill("linear", [0, 0], [60, 0], [0, 255], mtx);
shape.lineTo(width, 0);
shape.lineTo(width, height);
shape.lineTo(0, height);
shape.endFill();
shape._visible = false;
var mask_bd:BitmapData = new BitmapData(width, height, true, 0);
mask_bd.draw(shape);
bd.copyPixels(bd, bd.rectangle, new Point(0, 0), mask_bd, new Point(0, 0), false);
var refMC:MovieClip = createEmptyMovieClip("refMC", getNextHighestDepth());
refMC._x = p_source._x;
refMC._y = p_source._y+p_source._height;
refMC.attachBitmap(bd, 0, "Auto ", true);
}
包含的错误有:
1180: 调用的方法 createEmptyMovieClip 可能未定义。
1119: 访问可能未定义的属性 rectangle (通过 static 类型 flash.display:BitmapData 引用)。
1180: 调用的方法 createEmptyMovieClip 可能未定义。
1180: 调用的方法 getNextHighestDepth 可能未定义。
作者: futureengineer 发布时间: 2011-03-16
引用:
原帖由 flash023 于 2010-1-27 18:24 发表楼主不要着急,注册完了就开始学,要不了多久就能实现了。
学习过程中遇到问题了,讨论问题适合发到这个版块
http://flash.9ria.com/thread-40222-1-1.html
http://bbs.blueidea.com/thread-2969547-1-1.html
http://bbs.blueidea.com/thread-2970302-1-1.html
http://space.flash8.net/bbs/thread-397925-1-1.html
作者: flash023 发布时间: 2011-03-16
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28