How to add image at a particular position to the ParallaxNode.

How to add image at a particular position to the ParallaxNode.
0.0 0


Hi all,

I am having three images .

I have add three images to the parallaxNode .One is a static image at the back (z:–1),and the other two images(z:2) are of 1024 width and 512 height which move from right to left.
My problem is I have to add the two images one after another , I don’t know how to set the position of the second after another
to the parallaxNode.

My code :

var background = cc.Sprite.create(mainBg);
background.setAnchorPoint(cc.p(0.0, 0.0));

var layer1A = cc.Sprite.create(layer01A);
var layer1B = cc.Sprite.create(layer01B);


// create a parallax node, a parent node
this.parallaxNode = cc.ParallaxNode.create();


// background image is moved at a ratio of 0.4x, 0.5y
this.parallaxNode.addChild(background,–1, cc.p(0.0, 0.0), cc.p(0,0));

this.parallaxNode.addChild(layer1A,2, cc.p(0.4, 0.5), cc.p(0,0));
this.parallaxNode.addChild(layer1B,4, cc.p(0.4, 0.5), cc.p(0,0));

var goLeft = cc.MoveBy.create(5, cc.p(–1024, 0));
var goLeftDone = cc.CallFunc.create(this.spriteMoveFinished,this);

var sequence = cc.Sequence.create(goLeft,goLeftDone);

var repeatForever = cc.RepeatForever.create(sequence);




I have thought to add this code :
this.parallaxNode.addChild(layer1B,4, cc.p(0.4, 0.5), cc.p(1024,0));

or layer1B.setPositionX(1024);

But these doesn’t work.

Please guide me for a solution.