can a slider stop and continue while onPress?

  • meAsking
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Feb 17, 2004
  • Posts: 38
  • Status: Offline

Post March 19th, 2004, 5:10 pm

I searched and found one previous posting about my Q but didn't give me the right answer.

I have a slider called "but" and an element effected by the slider called "card1".

I'm moving "card1" according the the slider's output (its Y value), but "card1" is slightly changing its path as i move the slider way up or way down (outside of the stage) many times back and forth. To fix that, I'm guessing I need to limit the slider's output.

so... in order to prevent it from sliding too far I used the - delete onEnterFrame - command once the slider reached a certain point. the problem - I need to sometimes click on "but" a few times till it moves again (hence the jump to 64 in "onPress").

my question - is there a way to make the slider stop at certain point AND continue while the mouse is down?


Code: [ Select ]
function sliding() {
    this.onEnterFrame = function() {
        but._y = _ymouse;
        output = but._y-100;
        card1._x -= output/3;
        card1._y += output/4.5;
    };
}
but.onPress = function() {
    sliding();
    if (but._y == 60) {
        but._y = 64;
    }
};
but.onRelease = function() {
    delete onEnterFrame;
};
  1. function sliding() {
  2.     this.onEnterFrame = function() {
  3.         but._y = _ymouse;
  4.         output = but._y-100;
  5.         card1._x -= output/3;
  6.         card1._y += output/4.5;
  7.     };
  8. }
  9. but.onPress = function() {
  10.     sliding();
  11.     if (but._y == 60) {
  12.         but._y = 64;
  13.     }
  14. };
  15. but.onRelease = function() {
  16.     delete onEnterFrame;
  17. };
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post March 19th, 2004, 5:10 pm

  • meAsking
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Feb 17, 2004
  • Posts: 38
  • Status: Offline

Post March 19th, 2004, 5:24 pm

sorry, I ommited this part (comes inside sliding function)


Code: [ Select ]
    if (but._y<60) {
            delete onEnterFrame;
            but._y = 60;
        }

Thanks...
  1.     if (but._y<60) {
  2.             delete onEnterFrame;
  3.             but._y = 60;
  4.         }
  5. Thanks...
  • meAsking
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Feb 17, 2004
  • Posts: 38
  • Status: Offline

Post March 20th, 2004, 3:26 pm

Solved!
I took a different "road" though.
Thanks anyway.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post March 20th, 2004, 3:29 pm

meAsking,

Glad you joined us at OZZU and welcome you, but if you solved the problem yourself, we always encourage posters to post the solution. People come here from Google and all over the place to find help. It would be nice to know what the answer is.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • meAsking
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Feb 17, 2004
  • Posts: 38
  • Status: Offline

Post March 20th, 2004, 3:37 pm

Hopefully this is the right solution, but as I advance with my project I ran into another problem that I am about to post...
anyway:
My initial problem was
that "card1" kept slightly changing its path as i played with the
slider and moved it back and forth, so I thought that the possible
solution would be to limit the slider's output. I realized last
night that I need to limit the movement of "card1" not the slider,
so when card1 reaches the top right corner && the slider output is
above 0 it jumps back to the bottom left, and when card1 reaches the
bottom left && output < 0, card1 jumps back to the upper right
corner, so it'll always loop this way and card1 will never be
completely off and hopefully by that it won't change its path (I
hope).
It seems like its running ok now.

Thanks again.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 45 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.