player sprite flashes when moving in chrome
I think is related with Keydown event that tutorial says occures when key is pressed. But is continuously triggered during key is pressed instead of one time. Similar to keyTracker.
In firefox occures the same but image not flashes, background slows. I tried to fix this adding a if condition to not calling setAnimation() continuously but is insufficient.
How can i fix this? Thanks.
In firefox occures the same but image not flashes, background slows. I tried to fix this adding a if condition to not calling setAnimation() continuously but is insufficient.
How can i fix this? Thanks.
Comments
setAnimation()
continuously the effect will be that the animation will always be at the first frame.Could you provide a code example that produce this effect and tell me exactly which browser/version/os you're using ?
My browser is google chrome 26 and the code is like tutorial until object model chapter but with other sprites and player motion. Thanks!
The only thing i changed is wrap the entire switch of keydown event inside an if sentence. So when animation is loaded, not run setAnimation() again. Maybe is a problem of my computer, it's low range laptop...
Thanks for help me.
active:true;
and you should doactive = true;
. It may explain some of you problems.Do you mean that when you open your code into chrome 26 from the local file you get more flashes ? Or that when you open it from netbeans in some embedded browsers it flashes more?
The second problem is a netbeans problem i think. If i run the code from local file in chrome 26 works well. When open the file from netbeans but also in chrome 26 the problem appears. Still flashes although less without the error.
There is a chrome plugin that connects chrome to netbeans to debug. Maybe is related. But while runs well without netbeans no problem for me, this issue is solutioned for me :)
Thanks so much.