getting the stage from a container in kineticjs

Posted by seinecle on Stack Overflow See other posts from Stack Overflow or by seinecle
Published on 2012-11-09T16:29:51Z Indexed on 2012/11/09 17:00 UTC
Read the original article Hit count: 159

Filed under:
|
|
|

I have this stage associated to a container:

html:

<div id="container">

script 1:

var stageInFirstScript = new Kinetic.Stage({
    container: document.getElementById('container'),
    width: this.SKETCH_WIDTH,
    height: this.SKETCH_HEIGTH
});

In a second script, I need to manipulate the shapes on the stage I just created. Is it possible to retrieve stageInFirstScript with something like this?

script 2:

var stageInSecondScript = document.getElementById('container').RetrieveExistingStage();
//now I have retrieved stageInFirstScript
//I can add shapes to it, etc....

Any help or alternative solution would be appreciated!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html5