Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-12-2003, 05:40 AM   #1
ssjogus
Registered User
 
Join Date: Nov 2002
Posts: 41
Question play : revert

can we give a command to play a revert movie

like on press of a button, i write

_root.mv1.play();

and on another button i write

_root.mv1.play(revert) or something like that.

----------------

what i wan t to do is, i have a simple animation using motin tween. so when a picture in that animation reaches to a certain level, it should come back slowly (sort of rewind effect).

can we do like that? how?

shruti.
ssjogus is offline   Reply With Quote
Old 03-12-2003, 09:08 AM   #2
jaybee
Senior Citizen
 
jaybee's Avatar
 
Join Date: Feb 2003
Location: underneath the arches
Posts: 443
Default

there's a movieclip prototype here that does this or you could adapt to your own situation maybe.
jaybee is offline   Reply With Quote
Old 03-13-2003, 05:26 AM   #3
ssjogus
Registered User
 
Join Date: Nov 2002
Posts: 41
Default senior!!

from the photo you are looking very senior person. are you that much senior member?

about tutorial trying to understand it.

shruti.
ssjogus is offline   Reply With Quote
Old 03-13-2003, 05:51 AM   #4
ssjogus
Registered User
 
Join Date: Nov 2002
Posts: 41
Default

hi!

i have gone through the tutorial, but as i have very little background of scripting, not getting, how to do it. is there any easier tutorial, or some flash file?

shruti.
ssjogus is offline   Reply With Quote
Old 03-13-2003, 08:58 AM   #5
jaybee
Senior Citizen
 
jaybee's Avatar
 
Join Date: Feb 2003
Location: underneath the arches
Posts: 443
Default Re: senior!!

Quote:
Originally posted by ssjogus
from the photo you are looking very senior person. are you that much senior member?

about tutorial trying to understand it.

shruti.
I am indeed highly senior. I'm having a senior moment right now, in fact. Where did I put my teeth....

re that code, it could be quite difficult to understand if you're new to it.....basically movieclips don't have an inbuilt method that makes them go backwards so you have make your own. They do, however, have a method called prevFrame that sends them to, erm, the previous frame, so we can use that, and an event called enterFrame, which happens every time they, erm, enter a frame so combining the two you have:

ActionScript Code:
my_mc.onEnterFrame = function() { this.prevFrame(); }

if you put this code on frame one of a movieclip nothing would happen, cos there is no *previous frame* - so you might want to say "if you are on the first frame, start at the last frame and go backwards:

ActionScript Code:
my_mc.onEnterFrame = function() { this._currentframe == 1 ? this.gotoAndStop(this._totalframes) : this.prevFrame(); }

cos all movieclips have properties called _currentframe and _totalframes which we can use.....

but apply this to a clip and it will *always* go backwards. With flash mx you can apply and remove eventhandlers so you could go:

ActionScript Code:
movieclip.prototype.playBackwards = function(arg){ if(arguments.length>0) { this.onEnterFrame= undefined; this.play(); } else { this.onEnterFrame = function() { this._currentframe == 1 ? this.gotoAndStop(this._totalframes) : this.prevFrame(); } } }


........it might seem that all of a sudden it all got a lot more complicated but here we just add a method to all movieclips that can be used to apply and remove the code in the first example.......and you would call this with my_mc.playBackwards() and stop it with my_mc.playBackwards(false).....but it has the big disadvantage that the clip in question can't have any other enterFrame handler applied to it........incidentally the example I linked to earlier is prolly smarter/neater cos most things from that site are

have attached a version of this working
Attached Files
File Type: zip playbackwards.zip (2.7 KB, 812 views)
jaybee is offline   Reply With Quote
Old 03-14-2003, 03:35 AM   #6
ssjogus
Registered User
 
Join Date: Nov 2002
Posts: 41
Default

it seems that this fla file is created in MX. unable to open it flash 5. i had flash MX trial version, but the trial period of 1 month is expired.

shruti.
ssjogus is offline   Reply With Quote
Old 03-14-2003, 05:19 AM   #7
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Disregard this post if it is not the issue of playing forward and backward... I'm too lazy to read all of the thread...

I am just giving you an example on how to go forward and backward in F5...
Attached Files
File Type: zip forwardbackwardtest.zip (8.6 KB, 686 views)
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 03-14-2003, 09:49 AM   #8
ssjogus
Registered User
 
Join Date: Nov 2002
Posts: 41
Red face thanx

this solved my problem,

thank you.

shruti.
ssjogus is offline   Reply With Quote
Old 03-02-2005, 09:28 AM   #9
buzzby
buzzby
 
Join Date: May 2003
Location: london
Posts: 18
Default

the back and forth movement is all very well if you are tweening. but what if you are using script to generate the movement? is it a totally different process? if so how do you generate the script to move back if originally you have developed script to move an object 500 units. so to start with your clip is at a value of x=0 and it needs to move in a smooth motion to a spot called x=500 and then move back again in a smooth motion back to x=0 rather than just appearing at x=0 to move again slowly to x=500.

how is this done?

any comments would be grateful
buzzby is offline   Reply With Quote
Old 03-02-2005, 10:15 AM   #10
Laguana
Well known nobody
 
Join Date: Jul 2004
Posts: 818
Default

If you've got flash mx 2004, i believe there's a mx.tweens.yoyo or something, which does all the hard work for you. Otherwise you need to make something like so:

ActionScript Code:
myMC.speed = 5 myMC.direction = 1 // sets some variables... myMC.onEnterFrame = function() { this._x += this.speed * this.direction // makes it move either to the left or right by speed if (this._x > maxX || this._x < minX) { // if the clip is past the boundaries... this.dirextion *= -1 // make it go the other way } }
__________________
Wheels i've re-invented (or what concepts i've tried to bring to flash):

Matricies
Complex numbers

Current project:

Graphing program
Laguana is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:44 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.