A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Click and Hold button

  1. #1
    Junior Member
    Join Date
    Jan 2004
    Location
    Burlington, ON, Canada
    Posts
    2

    Click and Hold button

    I am not a flash programmer, so i apoglogize for the seemingly duh question!

    To give some background on it.

    I am trying to create something along the lines of this http://www.redhouse.ca/demo/tour/wel...150100019f.htm

    Notice the way the BUTTONS scroll the image.

    To do this, i elected using a simple tween animation for teh scroll, and buttons scroll frame by frame.

    I am not having a problem scrolling frame by frame foward (or right in this case), and I have no problem scrolling frame by frame backwards (left) .

    The problem lies in CLICK AND HOLD.

    I can click to make it move a frame at a time with this script

    on (press) {
    nextFrame();
    }

    that is the code i am currently using, however it only allows one frame PER click, I am trying to get it to do that until i let go of the mouse.

    on (press) {
    prevFrame();
    }

    I hope I make sense...

    Essentially, I would like to create a button that goes foward and backwards in the timeline frame by frame until i let go of the mouse. If i click it it will go one frame, if I click and hold it, it will go until I stop.

    I am an exterme Newb, so if anyoen can WRITE m a code that may work, I would be hugely appreciative! Or Send me to a tutorial to teach me how. Check out the demo above for reference on what I mean. Again, Noice the way the button interacts with the image .


    Any ideas and input will be greatly appreciated!

    Thanks in advance
    STEVE PELL
    ----------

  2. #2
    Junior Member
    Join Date
    Jan 2004
    Posts
    4
    I not a programmer either, so dont take my word for it ..
    but did you try using this?

    while(press){
    nextFrame()
    }

  3. #3
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Hi,

    instead of using buttons use movie clips (assuming you use MX or later), give each clip an instance name (eg leftArrow and rightArrow) then in the frame that contains the clips add the actions,

    code:

    leftArrow.onPress = function() {
    this.onEnterFrame = rewind;
    };
    rightArrow.onPress = function() {
    this.onEnterFrame = forward;
    };
    leftArrow.onRelease = rightArrow.onRelease = function() {
    delete this.onEnterFrame;
    };

    function rewind() {
    this._parent.prevFrame();
    }
    function forward() {
    this._parent.nextFrame();
    }


  4. #4
    Junior Member
    Join Date
    Jan 2004
    Location
    Burlington, ON, Canada
    Posts
    2
    If i convert a button to a movie aswell, can i still enable rollover effects? I really want to keep teh rollover effects aswell as the click an dhold effect. is this possible?


    Also, once it reaches Frame 1, how do i make it loop backward to frame 50 for leftArrow ?

    I am so lost! hehehe

    Btw, I got it to work, it just wont loop back to frame 50 once it reaches 1
    Last edited by Steve Pell; 01-20-2004 at 09:17 PM.
    STEVE PELL
    ----------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center