Uncaught TypeError: Cannot read property Add of undefined

醉酒当歌 提交于 2019-12-25 03:12:57

问题


HI im getting this error after executing my code. It says Uncaught TypeError: Cannot read property 'add' of undefined index.html:24 (anonymous function)

index.html

<link rel="stylesheet" type="text/css" href="resources/css/ext-all.css">
<script type="text/javascript" src="ext-all.js"></script>   
</head>
<body>
<script>
// Create a draw component
 var drawComponent = Ext.create('Ext.draw.Component', {
viewBox: false
});

// Create a window to place the draw component in
Ext.create('Ext.Window', {
width: 220,
height: 230,
layout: 'fit',
items: [drawComponent]
}).show();

// Add a circle sprite
var myCircle = drawComponent.surface.add({
type: 'circle',
x: 100,
y: 100,
radius: 100,
fill: '#cc5'
 });

// Now do stuff with the sprite, like changing its properties:
myCircle.setAttributes({
  fill: '#ccc'
 }, true);

// or animate an attribute on the sprite
myCircle.animate({
to: {
    fill: '#555'
},
duration: 2000
 });

 // Add a mouseup listener to the sprite
  myCircle.addListener('mouseup', function() {
  alert('mouse upped  ryru6!');
 });
  1. i have tried this code from sencha ext js documentataion website.

    • here is link of output image http://postimg.org/image/9r6kb7wxb/.

来源:https://stackoverflow.com/questions/23534201/uncaught-typeerror-cannot-read-property-add-of-undefined

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!