View Full Version : Get the parent object of Ext.draw.Sprite

12 Dec 2012, 12:12 PM
How to get the parent (Ext.draw.Component) for a sprite which referenced was recived from the mouse event.

It dont have up() method, as it is not component. And it is useless to use the element's up method .
Any other way to find the Ext.draw.Component for a sprite from its reference.

14 Dec 2012, 6:32 AM
The up method on an element is not going to resolve a component, it's going to try and resolve elements.

14 Dec 2012, 7:50 AM
Sorry, can you explicitly tell how to retrieve the component from sprite object?


14 Dec 2012, 9:22 AM
Try this. If you change the draw component's baseCls then '.x-surface' won't work - you'd need to use whatever you changed the baseCls to, but if you don't change it this should get you the draw component for the clicked (or whatever mouse event) sprite.

var drawComponent = Ext.create('Ext.draw.Component', {
viewBox: false,
items: [{
type: 'circle',
fill: '#79BB3F',
radius: 100,
x: 100,
y: 100
, listeners: {
click: function (sprite, e) {