1. #1
    Sencha - Training Team mrsunshine's Avatar
    Join Date
    Sep 2008
    Location
    Germany - Darmstadt
    Posts
    691
    Answers
    21
    Vote Rating
    12
    mrsunshine will become famous soon enough

      0  

    Default 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.
    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);
    			}
    		});
    i got render the canvas but i get no events from the sprit.

    in the draw guide is an example
    Code:
    // Add a touch listener to the sprite
    myCircle.addListener('touchstart', function() {
        alert('touchstarted!');
    });
    Does anyone succesfully listen on sprite events?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Answers
    3500
    Vote Rating
    853
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha - Training Team mrsunshine's Avatar
    Join Date
    Sep 2008
    Location
    Germany - Darmstadt
    Posts
    691
    Answers
    21
    Vote Rating
    12
    mrsunshine will become famous soon enough

      0  

    Default


    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

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    3
    Vote Rating
    0
    tonylsg is on a distinguished road

      0  

    Default 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?

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Location
    Cologne.Germany
    Posts
    5
    Vote Rating
    2
    ToRoll is on a distinguished road

      0  

    Default 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

  6. #6
    Sencha Premium Member
    Join Date
    Jul 2011
    Location
    Lambare - Paraguay
    Posts
    3
    Vote Rating
    0
    p431i7o is on a distinguished road

      0  

    Question Listeners on sprites

    Listeners on sprites


    Edit: Sorry I meant this post was to sencha extjs not sencha touch. My bad.
    ----------------------
    Any updates on this?
    I need to add listeners to the sprites specifically.


    The documentation says that the Ext.draw.Sprite has the events:beforedestroy
    • click
    • destroy
    • mousedown
    • mousemove
    • mouseout
    • mouseover
    • mouseup
    • render
    Any examples on this is welcome
    Last edited by p431i7o; 30 May 2013 at 6:12 AM. Reason: I didn't realize this post was on sencha touch forum

  7. #7
    Sencha Premium Member
    Join Date
    May 2011
    Posts
    8
    Vote Rating
    1
    xpironJB is on a distinguished road

      0  

    Default


    Hi Sencha-Team,
    are there any plans to extend Sencha Touch to support events on sprites in the future?

    Thanks for information!