button inside a sliding bar doesn't work

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post April 24th, 2004, 10:05 am

Ok, i'm sort of confused on what the exact problem is here.

Here's why.

1) I noticed your dr# clips stick if you click on another one before the other is finished opening or closing.

and

2) If it involves the bottom navigation panel that bounces in (which took me a while to figure out that that had a problem since all that code was commented out so I didn't bother to read it) then that problem is indeed because of how you are calling the onRelease.


If it is problem #1, the situation sadly would require a code re-write since the way you set up your if statements makes flash stop worrying about the previous clip and start focusing on the newly clicked clip.

If it is problem #2, then it's just a rearrangement of what to click. The reason this problem occurs is actually pretty simple. onRelease is a button handler that tells flash that when this clip is released, run these actions. Now, if the clip that contains this handler is the main container, nothing inside can be clicked upon because you will always be clicking the container that holds them.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 24th, 2004, 10:05 am

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post April 24th, 2004, 10:13 am

If it is problem #2, here is a quick re-write to the elastic function.

Code: [ Select ]
tpSlide.tab.onRelease = function() {
    if (_root.tpSlide._x>=765) {
        _root.tpSlide.onEnterFrame = function() {
            this.speedX = Math.floor((this.speedX*this.friction)+(this.baseX-this._x)*this.ratio);
            this._x += this.speedX;
        };
    }
};
  1. tpSlide.tab.onRelease = function() {
  2.     if (_root.tpSlide._x>=765) {
  3.         _root.tpSlide.onEnterFrame = function() {
  4.             this.speedX = Math.floor((this.speedX*this.friction)+(this.baseX-this._x)*this.ratio);
  5.             this._x += this.speedX;
  6.         };
  7.     }
  8. };



I targetted the tab clip within the tpSlide as the button to execute the elastic entry. This allows for the other clips to still be clickable.






Oh yeah, and in your first post you said you didn't understand the whole onEnterFrame thing.


onEnterFrame is the dynamic event handler (can be created/defined dynamically via AS) form of onClipEvent(enterFrame). A few of the plusses of onEnterFrame are...

1) Can be created/defined dynamically via AS
2) Helps cleaner code by having it all contained in a frame instead of scattered clips
3) Is deleteable via delete clipName.onEnterFrame; (note that you don't use the () at the end in this statement).
  • meAsking
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Feb 17, 2004
  • Posts: 38
  • Status: Offline

Post April 24th, 2004, 11:20 am

Thank you.
I'll difinitely let you know when finished (god help me ;-)
(and hopefully lostinbeta too...)
:lol:
  • meAsking
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Feb 17, 2004
  • Posts: 38
  • Status: Offline

Post April 24th, 2004, 11:24 am

sorry lostinbeta, i didn't notice there is another page.
i'm reading your post now.
  • meAsking
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Feb 17, 2004
  • Posts: 38
  • Status: Offline

Post April 24th, 2004, 11:50 am

lostinbeta U R D BEST :kingwithcrown:

it works!! I can't believe it's such a simple modification.
I only needed to target an element inside the bar otherwise it will always be like I'm clicking the whole bar (which is a bit weird because I'm specifying the name of what I'm clicking on i.e. tpSlide.tp1)

anyway, it works. yeepee. Now, I can go on with the other 1000 hours I still need to spend on this.

thank you! :dance2:
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post April 24th, 2004, 6:54 pm

Yes you are specifying the name of the clip, but the clip is within the main clip. So if you apply an onRelease action to the main clip, it considers all content inside it to be part of the main clip (as it is actually what makes up the main clip). So all other button handler actions within it are over-ridden.


Glad I could help btw :)

Post Information

  • Total Posts in this topic: 21 posts
  • Users browsing this forum: No registered users and 78 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.