why am I getting 1120: Access of undefined property ?
So I created this simple counter script to create a score board for a game.
import flash.events.MouseEvent;
redButton.addEventListener(MouseEvent.CLICK, randomOutput);
function randomOutput(e: MouseEvent): void {
var count: Number = 0;
count = count + 100;
Counter.text = (count).toString();
}
It worked fine on the stage timeline. but when I transferred this code to ActionScript file I get the 1120 error on both redButton and Counter Instance Names. why? what am I doing wrong?
Here is the full code for the ActionScript file
package {
import flash.display.MovieClip
public class myScript1 extends MovieClip {
public function myScript1() {
// constructor code
}
}
}
import flash.events.MouseEvent;
redButton.addEventListener(MouseEvent.CLICK, randomOutput);
function randomOutput(e: MouseEvent): void {
var count: Number = 0;
count = count + 100;
Counter.text = (count).toString();
}
