-
17 Apr 2012 3:35 AM #1Sencha - Training Team
- Join Date
- Sep 2008
- Location
- Germany - Darmstadt
- Posts
- 682
- Vote Rating
- 10
- Answers
- 21
Unanswered: How to add dag and drop listener to Ext.draw.Sprite?
Unanswered: How to add dag and drop listener to Ext.draw.Sprite?
Hi,
i like to drag and drop Ext.draw.Sprite's on a surface.
i got render the canvas but i get no events from the sprit.Code:var dC = Ext.create('Ext.draw.Component', { height : 500, width : 500, style : 'background: #fff;' }); view.add(dC); var sprite = dC.surface.add({ type: 'circle', fill: '#ff0', radius: 50 }); dC.surface.renderFrame(); sprite.on({ 'click' : function() { console.log(arguments); }, 'drag' : function() { console.log(arguments); }, 'touchstart' : function() { console.log(arguments); } });
in the draw guide is an example
Does anyone succesfully listen on sprite events?Code:// Add a touch listener to the sprite myCircle.addListener('touchstart', function() { alert('touchstarted!'); });trainings / workshops / consulting: Sencha Touch / Ext JS
Profile on SenchaDevs
www: http://www.nils-dehl.de
twitter: nilsdehl
meetup: Sencha Touch / Ext JS Meetup Frankfurt
videos: http://vimeo.com/album/1621422
conference photos: http://www.flickr.com/photos/nils-dehl/
-
17 Apr 2012 6:49 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
A sprite doesn't have an element, the surface gets the information from the sprite to draw the item so therefore the sprite won't have interactions, just the surface.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
17 Apr 2012 7:01 AM #3Sencha - Training Team
- Join Date
- Sep 2008
- Location
- Germany - Darmstadt
- Posts
- 682
- Vote Rating
- 10
- Answers
- 21
so what do you suggest to do if you want to have several sprites/images which should be positioned by drag and drop on a canvas / surface
trainings / workshops / consulting: Sencha Touch / Ext JS
Profile on SenchaDevs
www: http://www.nils-dehl.de
twitter: nilsdehl
meetup: Sencha Touch / Ext JS Meetup Frankfurt
videos: http://vimeo.com/album/1621422
conference photos: http://www.flickr.com/photos/nils-dehl/
-
23 Apr 2012 11:05 AM #4
hum, How to make animation on a component?
hum, How to make animation on a component?
so , I also want to know how to do that .
drawComponent.addListener('mouseup', function() { alert('mouse upped!');
});
the drawComponent works fine with the event . how to make a sprite with animation and event listeners?
-
19 Sep 2012 6:55 AM #5
how to catch events on sprites via surface ?
how to catch events on sprites via surface ?
+1
Hi,
I'm also kindly like to ask for any hint on how to get events (e.g. "click") catched from sprites (esp. with ST2.1.0 beta3).
Don't have a clue on how to get it via surface.
Thanks for any hint on this.
Torben


Reply With Quote