subtlefly Posted December 28, 2022 Share Posted December 28, 2022 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 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"); }); } } 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? Thanks for your help sub Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.