3.0 alpha - Flickering Sprites on Android (Images show and hide randomly)

3.0 alpha - Flickering Sprites on Android (Images show and hide randomly)
0.0 0


I am using the cocos2dx-3 alpha, my game works perfectly on html5 and iOS, but on android sprites flicker badly, i tried 2 different android devices, and both were the same.


I was able to find the part that makes it buggy.

onTouchesEnded, i create a Sprite, and when this sprite is added to the scene, it causes flicker, if you add them too fast.


Nice Job!


Well its not “Nice Job” because the bug is still there, i was just able to locate the line of code that causes the flicker.

onTouchesEnded -> addChild(sprite) = this causes it to flicker on android, but works perfect on iOS and Web.

i think its a cocos2d-x 3.0 alpha bug.


Could you upload a demo for test regearding to this question?


I have used this example: http://www.raywenderlich.com/33028/how-to-make-a-cross-platform-game-with-cocos2d-javascript-tutorial-the-platforms

Here is the zip with code: http://cdn3.raywenderlich.com/downloads/Cocos2DSimpleGame-JSBindings-Part2.zip

And added a background to it.

I was able to find a workaround for it today, by using the second paramater on addChild, and controling what goes in front.

this.addChild(mySprite, 100); // this worked as a workaround for android, i had to add it to every addChild call in my code.


hi, i tested this demo.
it can’t running with errors.
and why don’t you use script tools to create a project.
the tool’s path is cocos2d-x/tools/project-creator/create-project.py.
you can use this cmd to create a project.

python create_project.py -project p_name -package com.cocos.qwh -language javascript


I did use the create-project.py to make my project.

Flickering only happens on Android, web & iOS is perfect.

Its not really an issue for me now, because i pass in the z-index value, but someone else might run into it, and not know whats going on.

If you want to replicate, add a background sprite to the demo above.
add this at the beginning of the code:

var background = cc.Sprite.create(background);
background.setPosition(this.winSize.width/2, this.winSize.height/2);