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()
求大神指教 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询