Skip to main content
Participant
April 15, 2017
Question

correcting programming

  • April 15, 2017
  • 1 reply
  • 196 views

I did this programming, but it's not compiling. The user would enter two values, the program calculated and drew

I have no experience with Action Script, I did based on two programs that I found on the internet

var vt: Number = 0;
var w: Number = 2;
var f: Number = 60;
var amplitude1: Number;
var inicial1: Number;
var rad:Number;
var cosseno:Number;
var cos: Number;
var direçãoX: Number;
var direçãoY: Number;
var cosWaveColor:uint = 0x00FF00;
amplitude.text="";
inicial.text="";
var i:uint;
for(i = 1; i < stage.stageWidth; i++)


btn_enter.addEventListener(MouseEvent.CLICK, onClickHandler);

function onClickHandler(e:MouseEvent): void {
    switch(e.target.name){
        case "enter";
            if(amplitude.text != "")(inicial.text !=""){
                inicial1= parseFloat(inicial.text);                
                cosseno= w * i + inicial1;
                cos Math.cos(cosseno);                              
                amplitude1= parseFloat(amplitude.text !="");
                vt = amplitude1 * cos;               
                direçãoX=vt;
                direçãoY=i;
               
                graphics.beginFill(cosWaveColor);
                graphics.drawRect(i, cosWavePosition + cosPosY, 2, 2);
               
            }
        break;
    }       
}

This topic has been closed for replies.

1 reply

Colin Holgate
Inspiring
April 15, 2017

There are a lot of errors in the code. Also, it looks like you added code in the wrong place. When you looked at the example online, did you manage to get their version to work ok?

What page did you get the example from?

Participant
April 15, 2017

I did based on several videos

I have no experience with action script