A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: Backwards Tweening

  1. #1

    Red face

    I was wondering if this can be done or not.

    It I motion Tween an object to move across the screen by means of clicking on a forward button.

    Then if I click on the Backwards button can I make that object move back to its original position by doing it as a backwards tween????

    If so, how would you do this??

  2. #2
    Senior Moderator
    Defender of the Faith
    Pope de Flash's Avatar
    Join Date
    Feb 2000
    Posts
    3,429
    You can make a contorler clip that tells the movie clip to goto previous frame and then use a if get property to check if its at frame 1 and have it goto frame x to create a loop. If you do it the other way it will stop at the first frame. Regards, Bill

  3. #3
    Pope de Flash (Bill),

    Again, you give some great information. But I am still pretty new so I learn best by an example.

    I know it's like holding a little kids hand but man I sure would appreciate it if you could throw up a little more explanation.

    Here is what I am getting so far.
    Frame 1 = An Object
    Then a motion tween from Frame 2 to Frame 9
    Frame 10 will have the code to go to previous screen (within a button)
    Then in Frame 9 there will be some code saying:

    I guess this is where I get a little lost.

    Sorry I am so dense.

  4. #4
    Senior Moderator
    Defender of the Faith
    Pope de Flash's Avatar
    Join Date
    Feb 2000
    Posts
    3,429
    Sorry about that my fault

    heres what you do.

    You have the animation that you currently have.

    Now create a new movie clip that has three frames. In the first frame put a stop action. in frame two put an action that tells the movie clip that you have already created to go to previous frame and if at frame 1 go to frame 9. ie:

    If (GetProperty ("yourmovieclip", _currentframe )=1)
    Begin Tell Target ("yourmovieclip")
    Go to and Stop (9)
    End Tell Target
    Else
    Begin Tell Target ("yourmovieclip")
    Go to Previous Frame
    End Tell Target
    End If

    Now in frame three place an action to goto frame 2 and play.

    Now create a button that will tell the contorler to goto frame 2 and play on mouse over and on mouse out tell it to goto frame 1

    these are three independet items on the stage.
    Regards, Bill


  5. #5
    Wow,

    I must be completely retarded or else I am just not seeing it.

    It sounds to me like you are saying that I should have created a Movie clip with 9 frames in it. Right?

    Then Put that movie clip in the second frame of the stage.

    Then put the code you said to put in on the first second and third frames of the same or different layer.

    I don't know.

    Ahhhhhhhhhhhhhhhhhhhhhhhhhhh............ :-(

    <damn headache blocking my creative juices>

    If you don't want to explain any further I will understand.

    Sorry.

    Rob

  6. #6
    Not a Flash Kit Moderator
    The FlashDoctor

    Join Date
    May 2000
    Posts
    439
    Ok Here is a simple way that may work. Take the key frame that you started with. and when the user clicks it will go back to that frame but in a backwards tween motion.
    Button: Tween-----BackButton------Tween:Button
    Let me know if this works. if your main button is in fram e1, and it plays a 10 frame tween. Then oon the next button, just copy the keyframe in frame one and drop it into frame 22. This will just reverse the effect. Steve

  7. #7
    stevestarr,

    Thats true and I actually know it will work, but that will only be good if I was doing one object.

    I have a series of pictures that I will tween through and then I want to be able to tween backwards through them too.

    Do you know what I mean???

    Rob
    http://www.roblittle.com

  8. #8
    Not a Flash Kit Moderator
    The FlashDoctor

    Join Date
    May 2000
    Posts
    439
    That's fine, its not hard just do the same with each individual position. SO if the order is 12345 when you are on the flipside, switsch it over to 54321. And then make sure that all of your motion tweens are in tact. Steve.
    If you want to send me the final, I will take a stab at it for you, and I won't take your work don't worry, you can ask anyone in here and they will tell you I am able to be trusted. Thanks, Happy to help if needed. Steve

  9. #9
    stevestarr,

    That sounds easy enough but I must be missing something.

    Tween Tween Tween Tween
    1-------->10-------->20--------->30--------->40

    All of this on one layer.

    How do you make it go back???

    I know what you are saying but I don't see how you implement it.

    Rob

  10. #10
    Senior Moderator
    Defender of the Faith
    Pope de Flash's Avatar
    Join Date
    Feb 2000
    Posts
    3,429
    No, You have the movie clip you created with the 9 frames in it.

    You have a new movie clip with the code I told you to write.

    and you have the button with the actions it told you to write.

    Now you put them all on the stage at the same time. Each is an independet item on the stage. The button talks to the movie clip that I told you to create. The movie clip I told you to create talks to the movie clip you created with the alpha fade in it. Regards, Bill

  11. #11
    Pope de Flash,

    Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhh

    hahahaha

    This is ridiculous.

    God damn I am sooooooo retarded.

    I guess I will just have to try it tonight and see if I can do it. I still really don't understand the idea of the second Movieclip that you did explain.

    Thanks for being so patient with me,

    I really want to get good at this and everyone has helped me so much on this already.

    Thanks again,

    Rob
    http://www.roblittle.com

  12. #12
    Senior Moderator
    Defender of the Faith
    Pope de Flash's Avatar
    Join Date
    Feb 2000
    Posts
    3,429
    Send me an email so I can send you a zip file with an example in it. Regards, Bill

  13. #13
    Pope de Flash,

    Thanks for the email but that wasn't really what I was looking for.

    I want the image to be in a stopped action at first. Then I want to press the button and the image moves across the screen and stops. Then the other button will move it back across the screen. And I want to do this with many objects in order.

    Does that make sense???

    Rob

  14. #14
    Senior Member
    Join Date
    Aug 2000
    Posts
    127

    Smile

    OK, sorry to add to the confusion, but wouldn't it be easy to create a movie clip, with the forward part of the animation in it (lets say it's 15 frames.

    Now place a label at frame 1 called 'Forward', and a 'Stop' action at frame 15.

    Now copy all the frames, and paste them in frames 16 - 30, directly after the 1st anim (therefore repeating the anim). Select this second lot of frames (16-30) and right click, select reverse. Change the label of frame 16 to 'Backward'.

    Now all you have to do is have one button (the forward button) that uses the telltarget to play frames 1-15 of the movie clip, and one button (the backward button) that plays frames 16-30.

    Or have I got the wrong idea completely???!!!

    Reflex

  15. #15
    Senior Member
    Join Date
    Aug 2000
    Location
    New Brunswick, Canada
    Posts
    120
    Is this what you're looking for? The right button makes it reverse direction, the left will start it up again. Very crude but just made it up on the spot.

    (keeping fingers crossed since it's the first time I try to post an swf to the messageboard...)

    [swf width="460" height="40" background="#FFDDBB"]http://web-maestro.com/en/rob.swf[/swf]


  16. #16
    Senior Member
    Join Date
    Aug 2000
    Location
    New Brunswick, Canada
    Posts
    120
    If it is then this is basically how I did it.

    1 Layer background
    2 layer put a an object (red rectangle)
    1st frame start position
    15th frame stop position with a stop action
    16th frame is a copy of 15 without the stop action
    31st frame is a copy of the first first frame but add a stop action.

    Code in left button: basic got and play 1
    Action in Right button:

    On (Press)
    Go to and Play (31-_currentframe)
    End On


    This code actually allows it to reverse in both directions.


  17. #17
    Reflex ,

    No you have the right idea but what if I want to do more than one Movie Clips then in a row.

    Like I have a picture.
    It moves across the screen and then a new picture comes into
    the screen replacing the area that that last one was in.

    Rob

    <I think I might have just figured it out. But if you think of letme know>

  18. #18
    Senior Member
    Join Date
    Aug 2000
    Posts
    127

    Smile

    I see what you mean, but that's fine, all you do is create the individual clips, as I suggested, and then nest them inside one big clip. Inside the big clip is a button that allows you to activate the 'forward' part of the clip - and consequently moving it out of the way. This button also affects another clip's 'forward' anim, and it also moves forward, to fill the gap left by the previous clip!

    hope that makes sense...

    Reflex

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