Google Answers Logo
View Question
 
Q: rewind fast forward and tracking for swf files ( Answered,   0 Comments )
Question  
Subject: rewind fast forward and tracking for swf files
Category: Computers > Programming
Asked by: kman-ga
List Price: $15.00
Posted: 19 Dec 2002 08:53 PST
Expires: 18 Jan 2003 08:53 PST
Question ID: 126905
First let me say I will be happy to add a $100.00 bonus for a good
answer. I would like to add rewind, fast forward, and tracking
controls, similar to quicktime, to existing swf files.
great answer: I can batch process many files with a few clicks.
good answer: I open a single file in an application click a few times.
ok answer: I open a single file in an application change some code to
reflect the new file references.

Request for Question Clarification by lot-ga on 19 Dec 2002 17:09 PST
Hello kman-ga
Will you be publishing these modified .swf's on the internet or will
they be used on local drive only? Presumably you have the original
.fla's, or just  the unprotected .swf's? I'm sure you are aware, the
'play' button will only run the .swf until the the .swf stops, if
there is any interactivity involved like clicking the button to
'enter' or choosing options, the 'play' button of the 'quicktime' like
player will not know where to go. Hopefully your .swf's are pure
'linear' animation with no choices presented to the user.
regards lot-ga

Clarification of Question by kman-ga on 19 Dec 2002 19:07 PST
Will you be publishing these modified .swf's on the internet or will
they be used on local drive only? 

both


Presumably you have the original
.fla's, or just  the unprotected .swf's?

There are no original ,.fla's, the .swf was generated from an .avi
using an export routine in camtasia.


 I'm sure you are aware, the
'play' button will only run the .swf until the the .swf stops, if
there is any interactivity involved like clicking the button to
'enter' or choosing options, the 'play' button of the 'quicktime' like
player will not know where to go. Hopefully your .swf's are pure
'linear' animation with no choices presented to the user.

Yes, that's correct, essentially its a movie and I want to add vcr
controls
Answer  
Subject: Re: rewind fast forward and tracking for swf files
Answered By: skorba-ga on 20 Dec 2002 05:14 PST
 
Dear Kman -

If you have the swf movies, and want as little work as possible, then
the (maybe) best way is to create a separate swf-file and (with
rewind, play and forward controls) load each and every of your
swf-files into that movie.

I have written the code with Flash4 compliancy for the greatest
possible audience (98% of all web surfers have Flash 4 installed).

This you only have to do once:
1)
Open flash.

2)
Draw a little square, place it where you want your movie to load,
press F8 and make it into a movie clip. Name that movie clip
"placeholder" (also give it the "instance name" placeholder).

3)
Create a new layer for scripting. In the first frame, paste this code:

// first we tell the control movie to load your
// movie into the placeholder we created
loadMovie ( "YourMovie.swf", "placeholder" );

// Here you can change f.i. do_play to false if you
// do not want your movie to start playing at once
do_play    = true; 
do_rewind  = false;
do_forward = false;

// change the numbers if you want the rewinding 
// to be faster (5 is faster than 4 ...)
rewind_step = 3;
forward_step = 2;

4) 
Make a new keypoint on frame 2, and paste this code into that frame:

// This is the code that tells YourMovie to go forward, backward
// stop or play regularily:

if (do_rewind)
{
	pos = placeholder._currentframe;
	pos -= rewind_step;
	if (pos < 1) pos = 1;
	placeholder.pos = pos;
	tellTarget ("placeholder")
	{
		gotoAndStop (pos)
	}
}
else if (do_forward)
{
	len = placeholder._totalframes;
	pos = placeholder._currentframe;
	pos += forward_step;
	if (pos > len) pos = len;
	placeholder.pos = pos;

	tellTarget ("placeholder")
	{
		gotoAndStop (pos)
	}
}
else if (do_play)
{
	tellTarget ("placeholder")
	{
		play ();
	}
}
else
{
	tellTarget ("placeholder")
	{
		stop ();
	}
}

5)
Then you need to make another keyframe at frame 3and paste in this
code:

gotoAndPlay (_currentframe - 1);

This code merely instructs the controller movie to step back and
repeat the code at point 4 again.

6)
Then you need 3 buttons: One for rewinding, one for play/stop and one
for forward:

6a) The rewind button needs this code:
on (press)
{
	do_rewind = true;
}
on (release, releaseOutside)
{
	do_rewind = false;
}

6b)
The play/stop button needs this code:
on (release)
{
	do_play = !do_play;
}

6c)
The forward button needs this code:
on (press)
{
	do_forward = true;
}
on (release, releaseOutside)
{
	do_forward = false;
}

* * *

And that is all the scripting you need to control an imported movie. I
realize that this may be daunting if you have little experience with
ActionScripting. So I have zipped up all the files and placed them on
the net for you to look at (The one you want to look at is name
ScrubViewer.fla):

http://www.orgdot.com/ScrubViewer/ScrubViewer.zip

You can watch the result at
http://www.orgdot.com/ScrubViewer/

(You must of course disregard the ugly buttons and ugly design - you
propably are capable of making much better buttons than the ones I
have thrown together.)

Good luck!

Clarification of Answer by skorba-ga on 20 Dec 2002 05:53 PST
A note:

The project files you will find at

http://www.orgdot.com/ScrubViewer/

are slightly more advanced than the code specified above - it also
contains a pointer that marks the current position of the movie you
want to play. It is also possible to grab that marker and slide it
back and forth to set the position.
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy