PDA

View Full Version : Ext.draw.Component.surface is undefined



Ansichtssache
23 May 2013, 10:38 PM
I have the following code:


function getComponent() {
var group = Ext.create('Ext.draw.Component', {
draggable: true,
viewBox: false,
x: 200,
y: 200,
items: [
{
type : 'image',
src : 'images/MTDA.png',
width : 100,
height : 100,
group : 'sprites'
}
]
});

group.surface.add(Ext.create('Ext.draw.Sprite', {
type: 'circle',
fill: '#79BB3F',
radius: 5,
x: 34,
y: 18
}));

return group;
}

The API says, there is the property "surface" on a draw component. But Firebug keeps telling me, that group.surface is undefined. What's wrong with this code?

slemmon
28 May 2013, 10:56 AM
The surface will only be created when the draw component is rendered. After it's rendered you can add() additional sprites directly to its surface.