5
我對js仍然很陌生,我試圖將bonsai.js放入骨幹應用程序中。Uncaught TypeError:非法的構造函數 - 在Backbone.JS中使用Bonsai.JS
我在這裏按照本指南:https://github.com/iamdustan/bonsai-demos,並通過將動畫爲標題hero-animation.js
一個單獨的文件試圖「獨立的事情了」,但我對hero-animation.js
第一線得到Uncaught TypeError: Illegal constructor
這是叫我的骨幹路由器,並且工作正常...
homeAnimation: function() {
bonsai.run(document.getElementById('heroContent'), {
url: 'hero-animation.js',
width: 500,
height: 400
});
}
以下是我在這是導致錯誤在第1行英雄animation.js:
var rect = new Rect(0, 0, 200, 200);
rect
.fill('random')
.addTo(stage)
.attr({
x: stage.width - rect.attr('width'),
y: stage.width - rect.attr('height')
})
.animate('0.5s', {
x: 0,
y: 0
});
http://stackoverflow.com/questions/9950876/javascript-constructing-objects可能會幫助你。 – Loamhoof 2013-04-25 22:23:44