stopPropogation not working

Post your help queries and engine programming questions here

stopPropogation not working

Postby RiaanPie » Fri Aug 26, 2016 2:51 pm

In my project I am creating some navigation buttons that make certain things happen in my "world". All working fine, except that there's a DropDown element underneath the buttons (hidden) that should slide out when the nav button is clicked. This too works, except for the fact that when you click over the place where the DropDown resides, it fires the "drop out" part of it.

I add the buttons like this:

Code: Select all
jsonQ.each(data, function (key, value) {
                      frame = btnCounter + (btnCounter + 1); // set initial frame
                      var t = navButtons.push(new NavButton()
                            .id(key)
                            .texture(textures[1])
                            .mount(self.topBar)
                            .translateTo(navPosX - offset, navPosY, 0)
                            .width(115)
                            .height(78)
                            .scale().x(.8)
                            .scale().y(.8)
                            .cell(frame)
                            );
                      navPosX += 128;
                      btnCounter++;
                  });


Then, the code in the Class looks like this:

Code: Select all
init: function () {
       IgeEntity.prototype.init.call(this);
       this.isActive = false;
      
      this.mouseOver(function(event, control){
          this.cell(this.getFrames(this._id) + 1);
      })
        .mouseOut(function(event, control){
            if (!this.isActive) this.cell(this.getFrames(this._id));
        })
      .mouseDown(function(event, control){
          if (!this.isActive) {
              this.setActive();
              setCat(this._id);
          }
          this.stopPropagation();
      });
   },


I have also tried both event.stopPropogation() and control.stopPropogation().

Thanks!
RiaanPie
 
Posts: 20
Joined: Fri Jul 22, 2016 2:20 pm

Re: stopPropogation not working

Postby rob » Fri Aug 26, 2016 3:11 pm

I wonder if it is due to mouseUp() firing?

Could you add a mouseUp event handler and stop propagation on that as well?
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
rob
Site Admin
 
Posts: 316
Joined: Tue Oct 22, 2013 5:08 pm

Re: stopPropogation not working

Postby RiaanPie » Tue Sep 06, 2016 10:54 am

Just to close off this topic, it was indeed the mouseUp that was firing. I stopped propogation on that event and its working as desired now.
RiaanPie
 
Posts: 20
Joined: Fri Jul 22, 2016 2:20 pm

Re: stopPropogation not working

Postby rob » Tue Sep 06, 2016 11:49 am

RiaanPie wrote:Just to close off this topic, it was indeed the mouseUp that was firing. I stopped propogation on that event and its working as desired now.


Awesome :)
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
rob
Site Admin
 
Posts: 316
Joined: Tue Oct 22, 2013 5:08 pm


Return to Help & Questions

Who is online

Users browsing this forum: No registered users and 1 guest
cron