0
votes

![reference images]http://imgur.com/a/G9Skz

In screen1 user tap on a nail and screen2 shows up where user make designs on nail (basically add some layers on nail) after that it looks like screen3.

now What I want is when user come back to screen 1 it should see the nail he designed at the place of nail he tapped.

How can I do this?

Thanks!

ps:

I tried nail_sprite->getTexture() but it return just nail sprite not its child.

Child of nail_sprite include layers where user draw some thing at run time so I can't just pick up the whole draw_layer I have to only capture the part user draw something.

2

2 Answers

1
votes

First method is to pass the selected sprite-nail to the next scene by argument. So try this in Scene1:

var nailSprite1;
var nailSprite2;
var nailSprite3;
//and so...

var selectedNailSprite = nailSprite1;

Scene3:

selectedNailSprite.addChild(otherSprite);

Scene1:

selectedNailSprite.getChildren();

and after returning to the Scene1 you will have sprite with its all children. Don't recreate it, share it between scenes :)

Second method to achieve that is to make screenshot of Sprite from Scene 3 and save it on the device. Next you can load it in Scene 1.

Third method is to save nail's structure from Scene3 to XML or other format and load it in Scene1 :D

0
votes

here is my implementation in light of @sortris first method.

I created a method addLayer in parentLayer when ever I add a layer in child I call parent method too. and in case of stencil.drawDot when I draw a node in child layer I draw a node in parent Sprite too by calling parent method to drawDot.