corona - save a DisplayObjects to be reused between scenes -
how can save displayobjects reused between scenes?
example:
scene1 contains displayobject drawing.
in scene:exitscene
save storyboard.state.scene1.drawing
then when scene in scene:enterscene
do:
drawing = storyboard.state.scene1.drawing self.view:insert(drawing)
but error if drawing invalid.
given store reference displayobject in variable, this
no tested idea should work.
fromscene: local displayobj=yourdisplayobject -- when time change scene, this: local options={ local params ={ dispobj = displayobj, }, } storyboard.gotoscene(targetscene, options) --- targetscene: scene:createscene(event) local params=event.params local displayobj=params.dispobj --and whatever want displayobj ... ... end
doing in ways requires not nullify, or remove, display object in destroyscene of first scene.
Comments
Post a Comment