Uncaught TypeError: Cannot read property Add of un

2019-09-08 15:17发布

问题:

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/.
标签: Extjs