please help with assigning commands from a class - easelJS/animate cc/html5
Hi team,
So I have a tutorial (paid) but I am trying to understand something that I don't know what is going on.. I am (trying to be) running the interaction from a game.js file where all the code will be stored. I think I have worked out how to set up a web server and run the project as an index file (otherwise the interactions being read from the game.js file do not work)- this seems like a PITA but I have it working now.
So I have started a new project. I have a movie clip that has two frames in it (off and on) and the switch moves depending on if the light is off or on. Then I have a button instance name gobutt that can be used to call the lightAndSwitch movie clip to be on or off -
here is the code

So its all connected - no errors being thrown, but it doesn't work!
This is the same pathway as the example given (That works) but I am changing something by making my own project. How do I address the button and the movie clip from the game.js file?
class Game{
constructor(exportRoot, stage){
this.root = exportRoot;
this.stage = stage;
this.init();
}
init(){
const game = this;
this.root.gobutt.on('click', function(){
game.root.lightAndSwitch.gotoAndPlay("on");
});
}
}Thanks for your help
sub
