all groups > flash actionscript > march 2005 >
You're in the

flash actionscript

group:

play timeline backwards mystery


play timeline backwards mystery (_seb_)
3/16/2005 8:49:05 PM
flash actionscript:
Hi all

a long time ago I posted about this mystery and got no comment
whatsoever. Now, someone else said they were seeing it too, so now I
know it's real.

Here's the mystery:

Me and this other person are using an empty MC that excecute a script in
a two-keyframes loop, and the script's puprose is to make the flash
playhead play BACKWARDS in any targeted timeline.
That's very useful. The mystery is that although it takes that MC to
loop through two frames to make the playhead play backwards on frame,
when used, the movie plays substancially faster backwards than it
normally does forward.

This was observed on both Mac and Windows.

As anybody witnessed this, and does anybody know how that is possible?

Here's the script for the rewinder MC (provided ages ago by a forum user
called Navneet):

movieClip with 3 frames, with no graphics in it and it has
this structure

Frame1: Label: "fStop"
Frame2: Label: "fRewind"
Frame3: Label: "fRewLoop"

Actions on frame 1:

-------------------------------------
function playBackward($mcPath){
if(eval($mcPath)._currentFrame > 1){
eval($mcPath).prevFrame();
} else if (eval($mcPath)._currentFrame == 1) {
eval($mcPath).gotoAndStop(eval($mcPath)._totalFrames);
}//End if
}//End function
stop();
------------------------------------

Frame 2:

if(rewind == true){
playBackward(_level0.myMC2Rewind);
}//End if

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

Frame 3

if(rewind == true){
playBackward(_level0.myMC2Rewind);
gotoAndPlay(_currentFrame-1);
} else { gotoAndStop("fStop");
}//End if

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


Now, the button to activate the script: If the movie you want
to rewind is called myMC2Rewind and lives on _level0 So the path I will
use is
_level0.myMC2Rewind

So, on the button:
--------------------------------------
on (rollOver) {
if(_level0.mRewinder.rewind == true){
_level0.mRewinder.rewind = false;
}//End if
_level0.myMC2Rewind.play();
}//End rollover

on (rollOut) {
_level0.mRewinder.rewind = true;
_level0.mRewinder.gotoAndPlay("fRewind");
}//End roll out
---------------------------------------


--
Re: play timeline backwards mystery (_seb_)
3/16/2005 9:27:15 PM
I only see one playbackward for each frame, no matter how I look at it.

there's only one
eval($mcPath).prevFrame();
in the function,

and then the function is called once in frame2, and once frame 3.

Can you explain?

[quoted text, click to view]

--
Re: play timeline backwards mystery (_seb_)
3/17/2005 10:09:18 AM
bump, again...

[quoted text, click to view]

--
Re: play timeline backwards mystery Jeckyl
3/17/2005 12:54:35 PM
No great mystery It does two playBackward for each frame ,so it will play
twice as fast backward.
--
Jeckyl

Re: play timeline backwards mystery (_seb_)
3/17/2005 2:24:56 PM
thanks for the effort, but I really don't understand how the framerate
can be ignored:

in the rewinder MC,
frame 2 tells _root timeline to go back 1 frame.
frame 3 tells _root timeline to go back 1 frame. Then rewinder MC goes
back to frame 2, and so forth.

Doesn't the rewinder MC goes from frame 2 to frame 3 at the frame rate
specified in the movie? So how could the _root timeline go backwards
faster than the frame rate?


[quoted text, click to view]

--
Re: play timeline backwards mystery (_seb_)
3/17/2005 4:11:50 PM
thanks. But I still don't understand your explanation. I don't
understand why you say the action is excecuted repeatedly in frame 3

script in frame 3:

if(rewind == true){
playBackward(_level0.myMC2Rewind);
gotoAndPlay(_currentFrame-1);
}

I don't see how the action repeats, to me it means that on entering
frame 3, the rewinder checks if 'rewind == true', and if it is, the
targeted MC should go backwards ONE frame, ONCE, after what the rewinder
goes back to the previous frame (i.e. frame 2), where it checks if
'rewind' is still true, and so forth. I've been using action script for
years and I'm very surprised I'm not understanding this at all.

Do you mean that somehow, if a MovieClip's frames only contain
actionscript, then its timeline does not obey to the frame rate
specified in the movie?....

Or do you mean that a function called only once in a frame will just
excecute (loop) as many times it possibly can in that frame, until the
frame rate catches up?... If I call a function in a frame, I expect the
function to be excecuted once, not looped, no matter what the frame rate.

Plus, the function is NOT A LOOP in itself, it says:

if (something)
suchMC.prevFrame();

that should move suchMC once and only once, until the function is called
again, i.e. until the rewinder goes to the next frame, according to the
frame rate.

I don't see it!!! I don't see how it could be different! I don't
undertsand, please help

[quoted text, click to view]

--
Re: play timeline backwards mystery kglad
3/17/2005 4:14:34 PM
your _root timeline is playing twice your movie's framerate when you use:

gotoAndPlay(_currentFrame-1);

Re: play timeline backwards mystery kglad
3/17/2005 4:17:10 PM
p.s. actionscript is executed before anything is updated on-stage. your
actionscript in frame 3 executes and no frame is displayed or played. so, no
framerate time is taken by the playhead in frame 3.
Re: play timeline backwards mystery kglad
3/17/2005 7:49:11 PM
no, you're movieclip is never displaying anything on-stage in frame 3 of the
_root timeline and only displays frame 1 of the _root timeline once. it's
executing the actionscript in frame 3 (repeatedly) but after each execution of
script it the playhead returns to frame 2 with no frame (3) being played and
not taking the time required to play a frame.

and frame 1 of your _root timeline only plays once. calling a function that
exists in frame 1 of the _root timeline does not cause the playhead to move to
frame 1.

if you play your movie in the test environment you see your movie's playhead
staying or frame 2 after it plays frame 1.
Re: play timeline backwards mystery (_seb_)
3/17/2005 11:43:17 PM
wow, amazing, thanks.


[quoted text, click to view]

--
Re: play timeline backwards mystery (_seb_)
3/18/2005 1:33:49 AM
I think I finally understand:

if in frame 2 you have the code: prevFrame();
it doesn't take flash one framerate interval to go from frame 2 to frame
1, because Flash instantly obeys to the code and doesn't wait for the
frame rate to apply.

I get it!



[quoted text, click to view]

--
Re: play timeline backwards mystery kglad
3/18/2005 2:08:38 AM
the actionscript in frame 1 executes, then the stage in frame 1 is presented.
the playhead moves to frame 2 and executes that actionscript (and reverses your
movieclip 1 frame) and displays the stage in frame 2. so far, two frame rate
ticks have passed. ie, if your framerate is 1 fps, two seconds, more or less,
have transpired.

your playhead moves to frame 3 and executes the script there(reversing your
movieclip another 1 frame, 2 total) and immediately returns to frame 2,
displaying nothing on-stage and we still have only 2 frame ticks expended.
again, if your frame rate is 1 fps, 2 seconds have gone by and your movieclip
has moved back 2 frames.

the actionscript in frame 2 executes (and your movieclip is back 3 frames),
the stage in frame 2 is presented and another framerate tick (3) passes. frame
3 actionscript executes (and your movieclip is back 4 frames), the playhead
moves to frame 2 and we still have 3 framerate ticks. etc.

so, for every n+1 framerate ticks, your movieclip goes back 2n frames.
Re: play timeline backwards mystery kglad
3/18/2005 2:11:00 AM
i mean the actionscript in a frame can short-circuit the stage being presented.
if the stage is not presented no time off the framerate clock transpires.
code is excecuted almost instantly. you can use getTimer() to check or any
number of other experiements. if you insert a blank frame between frames 2 and
3 all will go as you expect.
Re: play timeline backwards mystery Jeckyl
3/18/2005 2:29:25 PM
the code in frame 3 executes, then it IMMEDIATELY goes to frame 2 (because
you told it to) and does the code there.

so the code in frame 3 and then frame 2 executes each time .. and as there
is your call to go backward in EACH of them, you are going back two frames
at a time.

remove the call to go back a frame out of frame 3 and all is well
--
Jeckyl


AddThis Social Bookmark Button