我想创建一个简单的课件来教学龄前学生的字母表。 我已经创建了这段代码。
var Drawing:Number=1;
var LineSize:Number=5;
var DrawColor:Number=0x000000;
var Canvas_sp:Sprite=new Sprite();
this.addChild (Canvas_sp);
Canvas_sp.graphics.beginFill(0xFF0000,0);
Canvas_sp.graphics.drawRect (18.15,74.45,349.60,291.65);
var Drawing_sh:Shape=new Shape();
this.addChild (Drawing_sh);
Canvas_sp.addEventListener (MouseEvent.MOUSE_UP,MouseUp);
Canvas_sp.addEventListener (MouseEvent.MOUSE_DOWN,MouseDown);
Canvas_sp.addEventListener (MouseEvent.MOUSE_MOVE,MouseMove);
function MouseUp(e:MouseEvent):void
{
Drawing=0;
}
function MouseDown(e:MouseEvent):void
{
var CanX:Number=Drawing_sh.mouseX;
var CanY:Number=Drawing_sh.mouseY;
Drawing = 1;
Drawing_sh.graphics.lineStyle(LineSize,DrawColor);
Drawing_sh.graphics.moveTo(CanX,CanY);
}
function MouseMove (e:MouseEvent):void
{
var CanX:Number=Drawing_sh.mouseX;
var CanY:Number=Drawing_sh.mouseY;
if (Drawing==1)
{
Drawing_sh.graphics.lineTo(CanX,CanY);
}
}
我创建了几条虚线,在舞台上形成一个字母表,将所有这些字母转换成单独的影片剪辑。那么我如何跟踪用户在影片剪辑上方绘制的字母表,以便我可以为所绘制的线条触摸的每个影片剪辑的分数进行分数。
另一个是我创建了一个多帧,一帧的字母表。当用户单击下一个按钮移动到下一帧时,我放置一个代码来清除画布中的所有图形。但它给了一些错误。下面是代码和错误。
stop();
/*next button*/
function gonextB53(event:MouseEvent):void
{
Drawing_sh.graphics.clear();
gotoAndStop(2);
}Object(this).nextB53.addEventListener(MouseEvent.MOUSE_DOWN, gonextB53);
错误:
TypeError: Error #1010: A term is undefined and has no properties.
at PSM_activities_fla::MainTimeline/frame2()[PSM_activities_fla.MainTimeline::frame2:124]
at flash.display::MovieClip/gotoAndStop()
at PSM_activities_fla::MainTimeline/gonextB53()[PSM_activities_fla.MainTimeline::frame1:135]