PDA

View Full Version : How can I get a specified Sprite reference from the Surface Object



liu78778
24 Jul 2012, 5:22 PM
var drawComponent = Ext.create('Ext.draw.Component', {
width: 800,
height: 600,
renderTo: document.body
}), surface = drawComponent.surface;


surface.add([{
type: 'circle',
radius: 10,
fill: '#f00',
x: 10,
y: 10
}, {
type: 'circle',
radius: 10,
fill: '#0f0',
x: 50,
y: 50,
group: 'circles'
}, {
type: 'circle',
radius: 10,
fill: '#00f',
x: 100,
y: 100
}]);


In this example, my question is:
How can I get the second sprite?
Is there a method like "get(Id)" or "getBy...()"?
Don't tell me to use the index of the item or the method "add", in some cases, you can't do.