Actionscript 3 如何在我的flash中使用以下文件?

Actionscript 3 如何在我的flash中使用以下文件?,actionscript-3,Actionscript 3,我从一个论坛复制了以下代码,但我不使用Flash 在stage上,我有一个我想要使用的jpg,我想使用下面的代码来编辑jpg。所以我只需编辑publish>>类>>lomobitmadata 并添加一个按钮来调用as文件,但当我这样做时,输出闪烁显示为“error 1114” 这是文件 包 { 导入flash.display.BitmapData; 导入flash.display.GradientType; 导入flash.display.Graphics; 导入flash.display.Sh

我从一个论坛复制了以下代码,但我不使用Flash

在stage上,我有一个我想要使用的jpg,我想使用下面的代码来编辑jpg。所以我只需编辑publish>>类>>lomobitmadata 并添加一个按钮来调用as文件,但当我这样做时,输出闪烁显示为“error 1114”

这是文件

包
{
导入flash.display.BitmapData;
导入flash.display.GradientType;
导入flash.display.Graphics;
导入flash.display.Shape;
导入flash.display.SpreadMethod;
导入flash.geom.ColorTransform;
导入flash.geom.Matrix;
导入flash.geom.Rectangle;
导入flash.display.Sprite;
公共类LomoBitmapdata
{
私有变量bitmapdata:bitmapdata;
私有变量lightBitmapdata:BitmapData;
公共函数lomobitmadata()
{
}
公共函数processLomo(bitmapdata:bitmapdata):无效{
this.bitmapdata=bitmapdata;
processSereen();
lightBitmapdata=bitmapdata.clone();
processInvert();
processRedAdd();
drawShape();
}
私有函数processPixel(乐趣:函数):void{
对于(var i:int=0;i 16;
绿色变量:int=color32>>8&0xFF;
蓝色变量:int=color32&0xFF;
var redInt:int=屏幕底图(红色,红色);
var greenInt:int=screenBase(绿色,绿色);
var blueInt:int=screenBase(蓝色,蓝色);
var newUint:uint=redInt 16;
绿色变量:int=top>>8&0xFF;
蓝色变量:int=top&0xFF;
var redbottom:int=bottom>>16;
变量greenbottom:int=bottom>>8&0xFF;
变量bluebottom:int=bottom&0xFF;
var resultR:int=redbottom;
var resultG:int=greenbottom;
var resultB:int=blue*0.2+bluebottom*0.8;

var newUint:uint=resultR您不够具体,因此很难给您具体的建议。您的代码是一个包含操作BitmapData对象的方法的类。典型用法是:

//provided you have a BitmapData instance ( let's call it bmd )... var lomo: LomoBitmapdata = new LomoBitmapdata( ); lomo.processLomo( bmd ); //如果您有一个BitmapData实例(我们称之为bmd)。。。 var lomo:LomoBitmapdata=新的LomoBitmapdata(); lomo.processLomo(bmd);
如果您不了解这一点,我建议您学习Actionscript 3,否则您将发现无法使用类似的代码示例。

请您更具体一点,比如告诉我们哪一行,您想做什么等?这个问题几乎值得否决。您需要解释您正在做什么,发生了什么,您想做什么nt将要发生等等。你不能只发布一大块代码,然后让别人去解决它。谢谢你的回复,我刚开始学习actionscript3,在使用as2之前,我只需要学习AS3几周。//如果你有一个BitmapData实例(我们称之为bmd)…var lomo:LomoBitmapdata=new LomoBitmapdata();我可以知道在按钮中使用以下代码的位置吗?lomo.processLomo(bmd);也是一个很好的资源 //provided you have a BitmapData instance ( let's call it bmd )... var lomo: LomoBitmapdata = new LomoBitmapdata( ); lomo.processLomo( bmd );