Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with loadFromJSON & loadFromDatalessJSON #42

Closed
TheRegge opened this issue Jul 30, 2011 · 1 comment
Closed

Help with loadFromJSON & loadFromDatalessJSON #42

TheRegge opened this issue Jul 30, 2011 · 1 comment

Comments

@TheRegge
Copy link

Hi kangax -- I am pulling my hair out trying to save a canvas state and reload it later. I am having zero success with either loadFromJSON and loadFromDatalessJSON (by the way, what is datalessJSON?). I have tried to put some elements on my canvas (they are loaded from svg), save the canvas as JSON (canvas.toJSON) into a variable. Clear the canvas, try to reload using one of the 2 methods mentioned above, and keep getting errors... I have tried from a JSON file, errors as well. My JSON was valid (I checked), but maybe not for what is expected by Canvas... it is not described in the doc, is it?

code example:

Myapp.mycanvas = Myapp.canvas.toJSON();
Myapp.canvas.loadFromJSON(Myapp.mycanvas);

The error:

JSON.parse: unexpected character
[Break On This Error] var Cufon=(function(){var k=function()....Image.fromElement.async=true})(this);

Down the line, do you think you could post an example of loading the result of a saved canvas back into a blank canvas? I have not seen anything like that in the examples, kitchensink etc...

@kangax
Copy link
Member

kangax commented Jul 31, 2011

Hi TheRegge. I saw you posted same question on SO, so I answered it there. Hope this helps, and sorry for the confusion.

@kangax kangax closed this as completed Jul 31, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants