Friday, 15 August 2014

ruby on rails - KineticJS: no method '_addId' in anonymous function -



ruby on rails - KineticJS: no method '_addId' in anonymous function -

so, trying work through kineticjs.image tutorial, run issue.

this works:

$(document).ready( function() { var icon = new image(); icon.onload = function() { var stage = new kinetic.stage({ container: 'canvas', width: 730, height: 700, }); var layer = new kinetic.layer(); var im = new kinetic.image({ x: -14, y: -13, image: icon, width: 30, height: 30 }); layer.add(im); stage.add(layer); }; icon.src = '#{asset_path "icons.png"}'; });

this, tutorial code, not:

$(document).ready( function() { var stage = new kinetic.stage({ container: 'targetcanvas', width: 730, height: 700, }); var layer = new kinetic.layer(); var icon = new image(); icon.onload = function() { var im = new kinetic.image({ image: icon, width: 30, height: 30, }); layer.add(im); stage.add(layer); }; icon.src = '#{asset_path "designer_icons.png"}'; });

it throws:

uncaught typeerror: object #<object> has no method '_addid' kinetic.js:28 kinetic.container.add kinetic.stage.add icon.onload

i have messed in environment, since in serious hack job of project (rails w/backbone,require,bootstrap , kinetic), , don't know javascript or various libraries, i'm fumbling around in dark.

any ideas what's causing , how prepare it?

it seems stage not initialized kinetic.node properly. create sure exists?

<div id="targetcanvas"></div>

and also, please create sure using version 4.3.1? don't see 4.3.1 has line.

if above not help, please post example, can take @ it.

ruby-on-rails kineticjs

No comments:

Post a Comment