A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: take me back

  1. #1
    Member
    Join Date
    Nov 2003
    Location
    Montreal
    Posts
    40

    take me back

    Hi, I'm trying to create a rewind button on my main timeline. I was hoping to get a button that would basically allow the user to rewind the movie until they release. On roll out the movie would play forwards again. Well it's the rewinding of the movie I can't figure out obviously. Any help would be great.

    Vij'n

  2. #2
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    code:
    rewindButton.onPress = function() {
    _root.onEnterFrame = function() {
    _root.pathToMC.gotoAndStop(_currentframe-20);
    };
    };
    rewindButton.onRelease = function() {
    _root.pathToMC.play();
    };


    Replace 20 with whatever number you want to have go back. 20 is a bit fast...
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  3. #3
    Member
    Join Date
    Nov 2003
    Location
    Montreal
    Posts
    40
    Tahnks for geting back to me Steve, but I have two questions concerning you reply.
    1. doesn't this script only rewind a movie clip and not the main timeline?
    2. does the script actually rewind or just skip to a frame 20 frames earlier?

    I'm looking to rewind the main timeline, not a movie clip. I can't figure it out. Basically, I want it to be a bit like a VCR, so that as long as you have the rewind button pressed it plays the main timeline in reverse until you release. And once you roll out it begins regular play again.

    Thanks for your help, I appreciate it but I'm not sure it's exactly what I'm looking for. If you happen to know how i can do this, please let me know.

    Vij'n

  4. #4
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    1. doesn't this script only rewind a movie clip and not the main timeline?
    Yes. That is what I thought you wanted to do.

    Just revamp it to look like:
    code:
    rewindButton.onPress = function() {
    _root.onEnterFrame = function() {
    _root.gotoAndStop(_currentframe-20);
    };
    };
    rewindButton.onRollOut= function() {
    _root.play();
    };



    2. does the script actually rewind or just skip to a frame 20 frames earlier?
    No, it goes back 20 frames at the fps (frames per second) of the movie. The line where it says:
    code:
    _root.onEnterFrame=function(){


    Makes it so the code following that occurs at the fps of the movie.

    And do you want it to play onRollOut or onRelease? You can do both if you wish like this:
    code:
    rewindButton.onRelease= rewindButton.onRollOut=function(){



    -Steve
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  5. #5
    Member
    Join Date
    Nov 2003
    Location
    Montreal
    Posts
    40
    Steve, you rock. I love it when I'm explained what does what and why. Thanks a lot. I'll try it out and see how it goes. Thanks again.

    Vij'n

    Just tried it an for some reason it's not working. i'm sure i'm doing something wrong. Am I supposed to put this code on a frame or my button? I've been putting it on the button. But nothing happens on press. I've targeted the right clip and there are no syntax errors. Wierd. Will have to keep on it.

  6. #6
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Shizit man, I screwed up. It won't rewind at the fps of the movie. WTF?!

    Argg....I'll keep workin on it.
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  7. #7
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Ag...Easy. I'm so freakin stupid sometimes, makin things a helluva lot harder than it needs to be.
    code:
    on (press) {
    _root.onEnterFrame = function() {
    prevFrame();
    };
    }
    on(release){
    delete this.onEnterFrame
    }


    Or for the real rewind feel:
    code:
    on (press) {
    _root.onEnterFrame = function() {
    _root.gotoAndStop(_currentframe-5) //or other number
    };
    }
    on(release){
    delete this.onEnterFrame
    }


    *shoots himself*
    Last edited by Steve_w_V; 11-22-2003 at 11:26 PM.
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  8. #8
    Member
    Join Date
    Nov 2003
    Location
    Montreal
    Posts
    40
    Hey Steeve,

    I tried the rewind button, it works perfectly except that there's something i didn't take into consideration, it that there are multiple scenes in the movie and so when it rewinds into another scene the release function doesn't work so it stay stuck in rewind. Anyway, so I figured I'd control it from another movie instead. That way I can avoid that problem. But of course, i ran into a wall. Anyway, I'm attaching the navigation file so you can see what I've tried to do. If you could take a look at the scond button, the rewind button and let me know what I've done wrong i would really appreciate it. I'm basically trying to control movie (A), using buutons in movie (B) (attached) Anyway, if you can't or don't have the time, no stress man. Later.

    S.
    Attached Files Attached Files

  9. #9
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Maybe he who downloaded it may have the time for it. It's not that I don't have the time, I have too much, but I am at school and these compooters don't have Flash. I'll DL it when I get home.

    -Steve
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  10. #10
    Senior Member Sir Yendor's Avatar
    Join Date
    Sep 2001
    Location
    Over here
    Posts
    1,140
    This is good stuff!

  11. #11
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Thank you Mr. Yendor

    Vijn- I cannot find any of your content! There is a lot of gotoAndPlay("frame label" code, but not content! Am I missin somethin?

    -Steve
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

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