luisdemarchi Posted October 10, 2013 Share Posted October 10, 2013 On my screen I have 10 images and 6 texts. I know that every time you call "stage.update()" is redesigned view screen. I have only two objects that need constant "stage.update ()". The first is a chronometer that needs every second to update a text and the second is an image that can be dragged around the screen. How do I create a "stage.update ()" exclusively for the object? ---- attempts: 1) I made an array of "stage" for a single canvas:canvas = document.getElementsByTagName ('canvas') [0];stage['full'] = new createjs.Stage(canvas);stage['chronometer'] = new createjs.Stage(canvas); The problem that when executed, one deleted another :stage ['full']. update ();stage ['chronometer']. update (); 2) I tried to create Container.containerTest = new createjs.Container();stage.addChild(containerTest); Problem? Could not update only what is in the container. Quote Link to comment Share on other sites More sharing options...
Bodman Posted October 10, 2013 Share Posted October 10, 2013 The only way to achieve what you are trying is to create 2 separate canvas objects, layered on top of each other (they are transparent by default).This is because the default behavior of stage.update is to clear the canvas. var fullCanvas = document.getElementsById('fullCanvas');var chronometerCanvas = document.getElementsById('chronometerCanvas');var stages = {}stages['full'] = new createjs.Stage(fullCanvas);stages['chronometer'] = new createjs.Stage(chronometerCanvas); Then you can call stages['chronometer'].update() without affecting the other canvas. Quote Link to comment Share on other sites More sharing options...
luisdemarchi Posted October 10, 2013 Author Share Posted October 10, 2013 The only way to achieve what you are trying is to create 2 separate canvas objects, layered on top of each other (they are transparent by default).This is because the default behavior of stage.update is to clear the canvas. var fullCanvas = document.getElementsById('fullCanvas');var chronometerCanvas = document.getElementsById('chronometerCanvas');var stages = {}stages['full'] = new createjs.Stage(fullCanvas);stages['chronometer'] = new createjs.Stage(chronometerCanvas); Then you can call stages['chronometer'].update() without affecting the other canvas. Could tell which is more "costly" for the system? a) Create 3 canvas. 1 with everything is fixed, one with the image that allows drag and 1 with the chronometer. b ) Staying giving "update" at all to update the chronometer and when the image drag. I speak Portuguese-Brazilian. Translated by Google. Quote Link to comment Share on other sites More sharing options...
Bodman Posted October 11, 2013 Share Posted October 11, 2013 2 Canvas elements should suffice . 1 for static, 1 for dynamic content. This is really something you are going to have to test on your own. Some older environments do not deal well with multiple canvas elements, where other's do every well. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.