Strange flicker and parallax phenomenon

I have several layers in my side scrolling game: (think mario)

  1. worldSurfaceLayerBG
  2. spriteLayer
  3. worldLayer
  4. worldSurfaceLayerFG

They have a specified depth as per the numbering within a layer (let’s call it ZoomLayer) which they are all added to…

1 is the surface the player walks on, positioned behind the spriteLayer (so a bush will be behind the player, for example)
2 is where all the action happens - player, baddies etc.
3 is the sub-terrain; the cross-section of the earth
4. is the surface the surface the player walks on positioned in front of the spriteLayer (so a bush will be in front of the player, for example)

Each frame, 1 and 4 remove all children, then draw all children in their new positions (sure, may be more efficient ways of doing this - but bear with me, please!)

1 flickers and appears to show some parallax effects

I modified 1 and 4 to be identical except for their z-position.

1 still flickers and shows parallax (at least in the Y direction - it is difficult to tell if it is doing so in the X direction).

Reposition 1 to be at any level ‘above’ 3 and it stops flickering (and showing parallax)
Reposition 4 to be at any level ‘below’ 3 and it starts flickering (and showing parallax)

In 1 and 4 there is nothing in the Layer itself (i.e. no code) and everything about them are identical except for their names.

the code that populates the sprites on these two layers is identical, again, except for the names.

I have tried repositioning the code that populates 1 and 4, changing depths, hiding one or other - all sorts of things.

This really has me stumped at the moment!

I realise without code it’s impossible to ask for real help - and the code is so entrenched in the whole game that I can’t really show much of interest (and there’s so little to see anyway!)

The parallax would seem to be the clue to me; I’m not doing anything ‘clever’. I’m not adjusting layer positions at all - and although I do scale some layers at times, they are scaled via the parent of 1,2,3,4 so all get scaled the same.

Any ideas? Anything you can think of that may help me debug this sort of issue?

It is running fine at approx 60fps.
It flickers etc. on a Mac build and an IOS build.

video uploaded to https://youtu.be/pZ7NqbVqwwM

(in the video the player is actually behind both the FG (red) and BG (green) layers. Level 3 isn’t visible

Solved ? i’m having similar flickr issue with my hero sprite when moving wrt to background layer , can you share how did you managed to solve this ?

I never found the issue - I ended up rewriting the way I did things from scratch and it worked OK - one day I will go back and compare solutions in source control to find out what the difference was.