A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Forward / Backward Buttons

  1. #1
    Degenerate and baise art thou. docree's Avatar
    Join Date
    Feb 2001
    Location
    USA
    Posts
    390

    Bacwards / Forwards

    How would I use buttons to reverse a Kool Moves animation?
    What I want to do is make a mock panoramic field that is
    moved "left or right" when the user clicks on a button.

    I think I could make an animation of the field moving to
    the right. Then, use buttons for left and right movement.
    The right button will play the animation when clicked.
    The left button will play the animation in reverse when
    clicked. Finally, when mouse out on the buttons the
    animation will stop on current frame.
    Now, what I need is, to be able to reverse play an
    animation/movie made in Kool Moves. Is this possible?
    Doc'Ree

    [Edited by docree on 02-11-2001 at 12:25 AM]

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Posts
    3,512

    Re: Bacwards / Forwards

    You can do this using a LoadMovie action with each button. Make a swf for one direction and another swf for the other.

  3. #3
    Degenerate and baise art thou. docree's Avatar
    Join Date
    Feb 2001
    Location
    USA
    Posts
    390
    Thanks, I'll test that out. I do kind of pridict a problem.
    Once the movies are loaded the button will keep on loading the movie and the on mouse out event won't work. Hmmmmm, maybe I'm just a little cautious. I have had a few projects "in other programs" ruined due to little things like this.
    Doc'Ree

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    You could also use the next frame and precvious frame actions assignesd to a couple of shapes. Just remeber to keep the tweens low. You could even assign them to an invisable layer to make one of those nice scrolling panaramas that we see so much now days.

    I would assign the action to the mouse over state. That way when you move the mouse off of the button it will stop the animation.




  5. #5
    Senior Member
    Join Date
    Aug 2000
    Posts
    766
    Docree-

    did you accomplish this?
    would like to see if you have, and how you finally decided to go about it.

    peace
    Brad

  6. #6
    Junior Member
    Join Date
    Mar 2001
    Location
    Indiana, US
    Posts
    22

    resolved forward/reverse buttons

    I couldn't find a way to do this only in KM, and don't know how one would do it in Flash ... but your question piqued my interest. So, I figured a way to do it using a little Javascript and the javascript action in KM. It's fairly simple ... Right now it's IE only. I'll mess with Netscape some other time...

    (whoops: update: I fixed it in Netscape. See bottom)

    Take a peek at:

    http://206.97.68.67/todd/panit.html

    The movie may play at the beginning - I didn't bother to stop that. But, the arrows at the bottom will exhibit the behavior you were interested in, namely: Play in forward or reverse direction when clicked and stop on mouseout.

    The advantage of doing it this way is that the panorama plays smoothly from the frame where the client is when the button is clicked, rather than jumping to an arbitrary point in another movie playing in the opposite direction ... make sense?

    I'm certain this can be improved, but hopefully it'll be some help!

    TD

    Note about Netscape javascript code: Some parameters necessary for Flash to interact with javascript are missing from the KM-generated <embed > tags, namely the name="" and swLiveconnect="true" tags. Without these, javascript can't "find" the Flash movie in the file to interact with it ... so, add 'em in. The 'name' parameter *must* match the 'id=""' value in the <object> tag. The other enables connectivity through Java, I believe. Both are necessary ... maybe someone else knows more about this than myself (very likely!)
    [Edited by kmfan on 03-12-2001 at 06:37 PM]

  7. #7
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    I've gotten it to work before with the method I described. The scripting bit that you did is pretty nice also. Either way you attempt this is appropriate.

  8. #8
    Junior Member
    Join Date
    Mar 2001
    Location
    Indiana, US
    Posts
    22

    forward/reverse buttons

    Originally posted by johnie
    I've gotten it to work before with the method I described. The scripting bit that you did is pretty nice also. Either way you attempt this is appropriate.
    Cool! I'd like to know how you got it to continue to scroll while mousing over one of the buttons. I only could get it to shift one frame at a time using the method you described ... I'd have to keeping moving on and off the button to move from one side of the panorama to another, one frame at a time. Fill me in ...

    TD

  9. #9
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    The Forward motion is Easy. Place a stop Movie Action on Each Frame and then add both a Goto Next Frame Action and a Play Movie on the Button. This works great if you only want to go Forward.

    The Reverse Button is trickier- I found the same problem that you did- With the on Roll Over Action it would only advance 1 Frame and then you had to move it off and then back on- This has to be a Bug...

    You can get around it if you only advance the movie 1 Frame at a time and then use the goto Frame and and stop action while using a new symbol in each frame.

    Your method seems to be better. How did you get past the On Rollover Bug?



  10. #10
    Junior Member
    Join Date
    Mar 2001
    Location
    Indiana, US
    Posts
    22
    Actually, it's the script that's controlling the frame position of the movie, not Flash. So, if there's a bug in Flash such as you mention, it never comes into play.

    Here's the little script:

    <script language="JavaScript">
    <!--
    function scrollIt(dir){
    var Frame = window.document.panit.CurrentFrame();
    window.document.panit.GotoFrame(Frame + dir);
    passit = dir
    if (passit != 0){
    setTimeout("scrollIt(passit)", 55)
    }
    }
    //-->
    </script>

    Flash movies with the 4 or 5 plugin have numerous javascript objects built into them. This script uses the CurrentFrame object, which returns the current frame (not key frame) that the movie is at, increments it by a value passed to it from the buttons in the movie, then uses the GotoFrame method to change the position of the movie. Make sense? On mouseout, the script is passed a value of 0 which halts its execution.

    So then, I built the swf with 3 keyframes and very high tweening to smooth out the stepping. It could be smoother with another key frame or two and matching the tweening to the number of pixels moved, but who's counting.

    Peace,

    TD

    PS: any chance that motion paths will be a part of KM soon? That would seem to me to be a great addition to a great program ... motion in circles/arcs/etc. sure would be nice...

    Originally posted by johnie
    The Forward motion is Easy. Place a stop Movie Action on Each Frame and then add both a Goto Next Frame Action and a Play Movie on the Button. This works great if you only want to go Forward.

    The Reverse Button is trickier- I found the same problem that you did- With the on Roll Over Action it would only advance 1 Frame and then you had to move it off and then back on- This has to be a Bug...

    You can get around it if you only advance the movie 1 Frame at a time and then use the goto Frame and and stop action while using a new symbol in each frame.

    Your method seems to be better. How did you get past the On Rollover Bug?



  11. #11
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Originally posted by kmfan
    Actually, it's the script that's controlling the frame position of the movie, not Flash. So, if there's a bug in Flash such as you mention, it never comes into play.

    Here's the little script:

    <script language="JavaScript">
    <!--
    function scrollIt(dir){
    var Frame = window.document.panit.CurrentFrame();
    window.document.panit.GotoFrame(Frame + dir);
    passit = dir
    if (passit != 0){
    setTimeout("scrollIt(passit)", 55)
    }
    }
    //-->
    </script>

    Flash movies with the 4 or 5 plugin have numerous javascript objects built into them. This script uses the CurrentFrame object, which returns the current frame (not key frame) that the movie is at, increments it by a value passed to it from the buttons in the movie, then uses the GotoFrame method to change the position of the movie. Make sense? On mouseout, the script is passed a value of 0 which halts its execution.

    So then, I built the swf with 3 keyframes and very high tweening to smooth out the stepping. It could be smoother with another key frame or two and matching the tweening to the number of pixels moved, but who's counting.

    Peace,

    TD

    PS: any chance that motion paths will be a part of KM soon? That would seem to me to be a great addition to a great program ... motion in circles/arcs/etc. sure would be nice...

    Originally posted by johnie
    The Forward motion is Easy. Place a stop Movie Action on Each Frame and then add both a Goto Next Frame Action and a Play Movie on the Button. This works great if you only want to go Forward.

    The Reverse Button is trickier- I found the same problem that you did- With the on Roll Over Action it would only advance 1 Frame and then you had to move it off and then back on- This has to be a Bug...

    You can get around it if you only advance the movie 1 Frame at a time and then use the goto Frame and and stop action while using a new symbol in each frame.

    Your method seems to be better. How did you get past the On Rollover Bug?


    Actually to be More Correct ALL versions of Flash including Future SPlash can be controled through Player Methods (In fact this was how Flash 3 Games were built and Bar preloaders were made with earlier versions of Flash), See Player Methods used to be real important in the early versions of Flash becuase they Lacked scripting and hence relied on FS Commands (Short for Future Splash Command- a tribute to the product that became Flash) to pass variables to the web page where they were evaluated by Javascript and then returned values back. Macromedia seems to remove Tech Notes on Older products but they aren't good enough at it becuase many sites still have Flash 2 and 3 tuts and techniques on them including passing FS Commands through the Get URL. I susspected that you used Javascript to set a variable and once I realized that the variable would be a constant until changed I saw that was how you got around the Bug.

    When I was refering to a bug I was refering to a possible bug in Kool Moves- I'll Check with another SWF Tool to see if I get the same results.

    Its a nice script and...

  12. #12
    Degenerate and baise art thou. docree's Avatar
    Join Date
    Feb 2001
    Location
    USA
    Posts
    390
    That's a nice script, but...
    Actualy I did not use a script for mine.
    I used what Kool Moves had.
    Built what I needed with Kool Moves.
    And, I don't have to worry about java script bugs.
    I'm writing out the example/tutorial today, will be uploaded tonight.
    Doc'Ree

  13. #13
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    A side note is that you can't use the script in a standalone projector... So that may be for the best if you are incorperating your project into a CD.

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