Trying to go to a random frame number with button click in HTML5 canvas
Hi,
I'm trying to make the timeline within a movie clip go to and stop on a random frame numer initiated with a button click.
I have a button called "testbtn" and a movieclip called "testmc"
I'm storing the frame numbers I want to be able to go to in an array and then picking a number from that array randomly, and then inserting that number into an "on-click" event.
The code I have is:
var _this = this;
this.frameA = [1, 2, 3, 4, 5];
var randomframe = Math.floor(Math.random() * this.frameA.length);
this.testbtn.on('click', function(){
_this.testmc.gotoAndStop(this.randomframe);
});
But it doesn't seem to work. Anyone know what I am doing wrong?
