PDA

View Full Version : draggable sprite



deepaganu123
17 Dec 2012, 6:23 AM
Hi All ,
I am trying to create a two overlapping sprite , when one sprite moves the other one should follow it . Right now i trying to track the co ordinates of the draggable sprite using onDragEvent but it doesnt seem to work can you please let me know what is wrong ?
// 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: 500,
height: 500,
layout: 'fit',
items: [drawComponent]
}).show();

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





myCircle.dd.onEnd = function(r)
{
alert('fr');
};

myCircle.show(true);