1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    4
    Vote Rating
    0
    Andreas_S is on a distinguished road

      0  

    Default Answered: Control A Sprite

    Answered: Control A Sprite


    Hi,

    i have some problems with controlling a Ext.draw.Sprite via the controller.
    At the moment i use the ".on" method to add eventlisteners to a sprite, but i'd like to control the sprite in my controller. Controlling the Ext.draw.Component is not a problem, it works fine.
    Code:
    this.control({
        'draw': {
            click: function(){console.log('it works');}
        }
    });
    But when i use the same Code with sprite it doesn't work. I also tried using the ID of the sprite, but that doesn't work either.
    Code:
    this.control({
        'sprite': {
            click: function(){console.log('it doesnt work');}
        }
    });
    I would be very happy if anyone could give me a hint for the solution of my problem.

    best regards
    Andreas

  2. this.control uses ComponentQuery which allows putting listener on any subclass of Ext.Component. Ext.draw.Sprite extends Ext.Base so it isn't a subclass of Ext.Component.

    Easy way to tell if you can use ComponentQuery is look at the API docs and see if Ext.Component is in the hierarchy...

    Attachment 29344
    Attachment 29345

    See how Ext.draw.Component (the 2nd picture) is a subclass of Ext.Component and Ext.draw.Sprint is not?

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,735
    Answers
    3364
    Vote Rating
    756
    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


    this.control uses ComponentQuery which allows putting listener on any subclass of Ext.Component. Ext.draw.Sprite extends Ext.Base so it isn't a subclass of Ext.Component.

    Easy way to tell if you can use ComponentQuery is look at the API docs and see if Ext.Component is in the hierarchy...

    Screen Shot 2011-11-16 at 3.05.32 PM.png
    Screen Shot 2011-11-16 at 3.05.45 PM.png

    See how Ext.draw.Component (the 2nd picture) is a subclass of Ext.Component and Ext.draw.Sprint is not?
    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.

  4. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    4
    Vote Rating
    0
    Andreas_S is on a distinguished road

      0  

    Default


    Thanks for your helpful reply.

    On the one hand it's bad that it doesn't work, but on the other hand it is good to know why it doesn't work.

    best regards
    Andreas

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar