Copy link to clipboard
Copied
It's not working for me i'm not sure why I was using it if it never worked. Did it change or something?
this.gotoAndStop(20);
It's the correct syntax for going to the 21st frame. If your last frame is really 20, then you would want this.gotoAndStop(19). CreateJS frame numbers start from zero.
Another possible cause would be if the this.gotoAndPlay(20) is inside a function, and in the listener that takes you to the function you didn't bind 'this'. For example:
this.someBtn.addEventListener("click",gosomewhere.bind(this));
function gosomewhere(){
this.gotoAndStop(20);
}
should work, the bind(this) part would make the function
...Copy link to clipboard
Copied
It's the correct syntax for going to the 21st frame. If your last frame is really 20, then you would want this.gotoAndStop(19). CreateJS frame numbers start from zero.
Another possible cause would be if the this.gotoAndPlay(20) is inside a function, and in the listener that takes you to the function you didn't bind 'this'. For example:
this.someBtn.addEventListener("click",gosomewhere.bind(this));
function gosomewhere(){
this.gotoAndStop(20);
}
should work, the bind(this) part would make the function use the main timeline's 'this' instead of the function's own 'this'.
Copy link to clipboard
Copied
ok I see the issue. I think when i was using actionscript it stopped on the actual frame instead of starting frame 0.
Copy link to clipboard
Copied
another thing that is different is the last frame (lets say its on frame 30) where im adding this.gotoAndPlay("startAnimation");
In actionscript it would go to frame 30 then execute this.gotoAndPlay("startAnimation");
in html5 canvas it never actual reaches frame 30 it executes this.gotoAndPlay("startAnimation"); before it reaches frame 30. So anything i have on frame 30 doesn't show up. This really isn't a problem now that i know whats going on but it threw my off as to why the stuff on frame 30 wasn't showing up.
Copy link to clipboard
Copied
It used to be that way in ActionScript as well. It wasn't until Flash Player 10 that code was aware of the frame you had just jumped to. In Flash Player 9 you had to wait around for a frame before being able to do things.