Results 1 to 6 of 6

Thread: Playing flash backwards to a stop

  1. #1
    Join Date
    Dec 2007
    Location
    Mississauga
    Posts
    166
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default Playing flash backwards to a stop

    I have seen a lot of different ways on the net to play tweens backwards, most common is the prevFrame(); command I find.

    The only trouble is I have a tween that has keyframes that stop. So I need to find out how to have a prev button that plays the tween inside an mc backwards to either a stop command or a designated frame number set in the button itself.

    Does anyone know of any tutorials or can give me some insight as to how to go about it?


    -- Nate

  2. #2
    Join Date
    Aug 2007
    Location
    Harrisburg, PA
    Posts
    131
    Thanks
    6
    Thanked 9 Times in 9 Posts

    Default

    One way to do it is to make a direction variable and say currentframe + what ever the direction so going forward would be dir = 1 going backward dir = -1

    So it is constantly checking to see if it should go forward or backwards you could us an EnterFrame event and then with other event listeners change the direction.

    heres an example put together on some buttons since its pretty self explanitory

    the files at.

    www.jchamb.com/files/buttons.zip

    each button is an instance and the code is inside of that button, but could easily be worked around in other ways.

  3. #3
    Join Date
    Dec 2007
    Location
    Mississauga
    Posts
    166
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Hey punstc,

    Great example and it works really well, but do you know if the idea would work where the animation is in a seperate mc from the button and the mc had stop commands?

    I am wondering because the way it works I wonder if it would bypass the stop(); frame like the prevFrame(); command does.

  4. #4
    Join Date
    Aug 2007
    Location
    Harrisburg, PA
    Posts
    131
    Thanks
    6
    Thanked 9 Times in 9 Posts

    Default

    Off the top of my head I would say yes since its running off of an enter frame and just goes to the next or previous frame its not really paying attention to stops and other things on the timeline.

    I'll see if I can throw together another example for you here in a bit when i get a chance.

    UPDATE

    alright i got it working. There is one problem with the current way i have it set up though. If you try to add in multiple movie clips using the same functions and var (in the examples case dir) since they are all waiting to hear from that dir they will all go. If you would take the time and write conditional statements out and creat a couple other variables you should be able to apply it to more then one movie clip at a time.

    heres the example file:
    www.jchamb.com/files/buttons2.zip
    Last edited by punstc; 02-21-2009 at 12:03 AM. Reason: Update

  5. #5
    Join Date
    Dec 2007
    Location
    Mississauga
    Posts
    166
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    No need, I solved my own problem. Here how I went about it for anyone who is looking for the same solution.

    On my main timeline I have my two arrows (left and right) and my thumbnails slides. I made a tween to scroll through the thumbnails in groups of three. The first frame has this AS
    Code:
    rewind_btn.onPress = function() {
    	onEnterFrame = function(){
    		prevFrame();
    	}
    }
    forward_btn.onPress = function() {
    	onEnterFrame = function(){
    		nextFrame();
    	}
    }
    stop();
    onEnterFrame = function() {
    	delete onEnterFrame;
    }
    which sets up the buttons actions and a stop command.

    I placed this code on the rest of the stop frames
    Code:
    stop();
    onEnterFrame = function() {
    	delete onEnterFrame;
    }
    The "stop();" alone will be ignored when the tween is played in reverse so thats what the "delete onEnterFrame" command does.

    And that's it, it works like a charm. Hopefully this post will help anyone else with this problem.

  6. #6
    Join Date
    Feb 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I have just used nate51's solution to create a sliding menu with stops forward and backwards. Worked ok. But what if I want to make it loop?? I mean.. when I'm on the last frame, I've put a gotoAndPlay(1) and I'm set.
    But what about the first frame?

    thank you

Bookmarks

Posting Permissions

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