flash as3运行输出TypeError: Error #1006: run 不是函数
动态绘制正弦曲线的程序package{importflash.display.Sprite;importflash.display.Shape;importflash.e...
动态绘制正弦曲线的程序
package{
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.Event;
public class wave extends Sprite{
private var circle:Shape=new Shape();
private var sinline:Shape=new Shape();
private var horline:Shape=new Shape();
private var verline:Shape=new Shape();
private const r:Number=110;
private var angle:Number=0;
public function wave(){
circle.graphics.beginFill(0xff00ff,.5);
circle.graphics.drawCircle(0,0,10);
circle.graphics.endFill();
sinline.graphics.lineStyle(2,0xff0000);
addChild(circle);
addChild(sinline);
addChild(horline);
addChild(verline);
}
public function run(){
circle.addEventListener(Event.ENTER_FRAME,circleenter);
}
public function hold(){
circle.removeEventListener(Event.ENTER_FRAME,circleenter);
}
public function reset(){
hold();
angle=0;
circle.x=circle.y=0;
sinline.graphics.clear();
sinline.graphics.lineStyle(2,0xff00ff);
horline.graphics.clear();
verline.graphics.clear();
}
public function circleenter(e:Event){
angle+=2;
var tempx:Number=-r+r*Math.cos(angle*Math.PI/180);
var tempy:Number=-r*Math.sin(angle*Math.PI/180);
circle.x=tempx;
circle.y=tempy;
sinline,graphics.lineTo(angle,circle.y);
horline.graphics.clear();
horline.graphics.lineStyle(1,0x00ff00,.5);
horline.graphics.moveTo(circle.x,circle.y);
horline.graphics.lineTo(angle,circle.y);
verline.graphics,clear();
verline.graphics.lineStyle(1,0x0000ff,.5);
verline.graphics.moveTo(circle.x,circle.y);
verline.graphics.lineTo(circle.x,0);
}
}
}
不报错但是输出
TypeError: Error #1006: run 不是函数。
at wave/runhd()
求大神指教 展开
package{
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.Event;
public class wave extends Sprite{
private var circle:Shape=new Shape();
private var sinline:Shape=new Shape();
private var horline:Shape=new Shape();
private var verline:Shape=new Shape();
private const r:Number=110;
private var angle:Number=0;
public function wave(){
circle.graphics.beginFill(0xff00ff,.5);
circle.graphics.drawCircle(0,0,10);
circle.graphics.endFill();
sinline.graphics.lineStyle(2,0xff0000);
addChild(circle);
addChild(sinline);
addChild(horline);
addChild(verline);
}
public function run(){
circle.addEventListener(Event.ENTER_FRAME,circleenter);
}
public function hold(){
circle.removeEventListener(Event.ENTER_FRAME,circleenter);
}
public function reset(){
hold();
angle=0;
circle.x=circle.y=0;
sinline.graphics.clear();
sinline.graphics.lineStyle(2,0xff00ff);
horline.graphics.clear();
verline.graphics.clear();
}
public function circleenter(e:Event){
angle+=2;
var tempx:Number=-r+r*Math.cos(angle*Math.PI/180);
var tempy:Number=-r*Math.sin(angle*Math.PI/180);
circle.x=tempx;
circle.y=tempy;
sinline,graphics.lineTo(angle,circle.y);
horline.graphics.clear();
horline.graphics.lineStyle(1,0x00ff00,.5);
horline.graphics.moveTo(circle.x,circle.y);
horline.graphics.lineTo(angle,circle.y);
verline.graphics,clear();
verline.graphics.lineStyle(1,0x0000ff,.5);
verline.graphics.moveTo(circle.x,circle.y);
verline.graphics.lineTo(circle.x,0);
}
}
}
不报错但是输出
TypeError: Error #1006: run 不是函数。
at wave/runhd()
求大神指教 展开
展开全部
verline.graphics,clear();
更多追问追答
追问
改了还是不行怎么办
追答
runhd()为什么是这个而不是run(),我已经试过了,你给软件应该已经没有报错了,只是看起来是空白,估计是坐标的问题,在最大化之后可以看见
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询