SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    Zero Point Zero Siebird's Avatar
    Join Date
    Feb 2007
    Location
    York, PA
    Posts
    456
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    play reverse motion tween

    Hi All,

    I think there is a pretty easy solution to this, i am very new to actionscripting...what I want to do is, i have a button and plays a motion tween and stops, then at the end i have a button that i want it to play in reverse back to the frame label, and then back to the very first frame 'start'? hopefully that makes sense. Thanks

    Code Actionscript:
    //start clip - this resided on the very first frame 'start'
    on (release) {
    	gotoAndPlay('antiqueBronze');
    }
     
     
    //then i have this at the end of the 'antiqueBronze'
    on (release) {
    	prevFrame('antiqueBronze');
    }
    //i know there is more to this, thats why i am asking

  2. #2
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hello

    The best way to do this is to:

    highlight the frames in question
    copy them
    create a new blank keyframe on the timeline
    right click there and choose paste frames
    highlight the newly pasted frames
    right click on them and choose reverse frames

    Make sure to redo the labels for the new frames so they are positioned where you want.

    Hope it helps.

  3. #3
    Zero Point Zero Siebird's Avatar
    Join Date
    Feb 2007
    Location
    York, PA
    Posts
    456
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Johnny,

    the problem then is, I have 19 different buttons that I want to do this with, and i just seems like there is an easier way of doing this...i use this script a lot for reverse animation, could I modify this???

    Code Actionscript:
    // check to see if the mouse is over the menu every time a new frame is entered
    onClipEvent (enterFrame) {
    	// if the mouse IS over the menu ...
    	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
    		// if the menu is NOT fully open
    		if (this._currentframe<this._totalframes) {
    			// go to the next frame of the menu opening sequence
    			nextFrame();
    		}
    		// if the mouse is NOT over the menu
    	} else {
    		// if the menu is NOT fully closed
    		if (this._currentframe>1) {
    			// play the previous frame of the menu opening sequence
    			prevFrame();
    		}
    	}
    }

  4. #4
    SitePoint Guru krityx's Avatar
    Join Date
    Jan 2006
    Location
    Around
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you cant reverse motion tweens via actionscript. the easiest way is the way johnny suggested.


  5. #5
    Zero Point Zero Siebird's Avatar
    Join Date
    Feb 2007
    Location
    York, PA
    Posts
    456
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That script lets you play an animation, then once the animation is done, once the mouse rolls out, it plays it in reverse, isnt that reverse motion tweening?


    Example:

    frame1: stop
    hover over instance, goes to next frame and plays
    frame2-5: motiontween
    frame5: stop
    then once you roll out, it plays in reverse

  6. #6
    SitePoint Guru krityx's Avatar
    Join Date
    Jan 2006
    Location
    Around
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    impossible ! you just can't !
    your best option would be to make (manually) a reverse tween from frame 6 to 9(using the method johnny suggested and on roll out to play from frame 6.

    OR

    to tween via AS using the Tween class . this gives you more control over the animation and also makes things (like reverse) a lot easier.


  7. #7
    Zero Point Zero Siebird's Avatar
    Join Date
    Feb 2007
    Location
    York, PA
    Posts
    456
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll put a source file up for you to look at... I'm curious if this isn't reverse motion tweening with actionscript, then what is called??? Thanks

    example .fla

  8. #8
    SitePoint Guru krityx's Avatar
    Join Date
    Jan 2006
    Location
    Around
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well it is via actionscript. the thing that makes it work is that you have an enterFrame event and within that event you check to see if the currentframe > 1 and if it is it will go 1 frame behind, and it will go 1 frame behind until the current frame will be 1.
    we can say it's reverse motion tweening via actionscript. very good idea !


  9. #9
    Zero Point Zero Siebird's Avatar
    Join Date
    Feb 2007
    Location
    York, PA
    Posts
    456
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but I can't take credit for the idea, I forget where I found that script...

    Anyways, do you know how I could do this with frame labels, instead of frame#'s?

    Right now, I am doing it the long easy way, its just taking forever, I will have to post what I am doing when I am finished with it, its a color visualizer where you can change colors of a barn roof, trim and siding...

  10. #10
    SitePoint Guru krityx's Avatar
    Join Date
    Jan 2006
    Location
    Around
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dont think it's possible with frame labels since the _currentframe returns only numbers.



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
  •