Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make an .flv redirect after it has been viewed?

Status
Not open for further replies.

rvrtrnce

Technical User
Oct 12, 2007
9
US
need a way to redirect a viewer of a flash .flv movie to a page of my choosing after they have watched the entire movie. I can't figure out how to do it in actionscript, manually or with parameter tags in the html.

The user watches the video on the website ( a lectue/presentation) and then has to take a quiz. I need a way to have the video automatically (or with an embedded link) go to another url that has an embedded flash quiz after the user has watched the entire video to prevent them from skipping the video and going right to the quiz.

I created the flash by importing the video using the "streaming from a server" method. My fla library only has the skin and the flv playback icon. On the webpage I embed the swf and i reference the flv to play it back for the viewer.

I have to use a streaming .flv because they are long lectures and they will be viewed on the web. If it was embedded I coul put a link in the timeline at the end but the videos are way to big. I've tried putting the link in the second frame (the first frame contains the entre .flv) but this just makes the video skip the .flv and loop the two frames.

I could either use some simple actionscript for my one and only frame to redirect to another url or possibly a param in the object code after implemetation into the web page that redirects after viewing.

Here's the link to the test video on the webpage:
As you can see I need to put that text link inside the flash! PLEASE HELP!

I can send an example .flv with the same implementation metod if you need me too!

Matt
 
Here's my AS for the complete event:

not_set_yet.addEventListener("complete",);

Can you elaborate furthur?

Thank you
 
Code:
import mx.video.*;

var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
    getURL("[URL unfurl="true"]http://www.whatever.com/");[/URL]
};
my_FLVPlybk.addEventListener("complete", listenerObject);

Kenneth Kawamoto
 
All I ahve in my library is the FLVPlayback icon, which I have dragged to the stage as is.

Do I need to change the FLVPlybk to a symbol called my_FLVPlybk for this to work and then put it on the stage with an instance name of my_FLVPlybk?

Please elaborate or explain the code further, I really appreciate it.



 
I named the instance correctly and it's giving me 4 errors, I pasted exactly what you told me and I replaced the url. I know the url action works because if I just put in the get url statement it opens the page as soon as I start previewing it, here's what I got:

import mx.video.*;

var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
getURL(" _blank);
};
my_FLVPlybk.addEventListener("complete", listenerObject);
 
Here's the error log:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 16: Statement must appear within on/onClipEvent handler
import mx.video.*;

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 18: Statement must appear within on/onClipEvent handler
var listenerObject:Object = new Object();

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 19: Statement must appear within on/onClipEvent handler
listenerObject.complete = function(eventObject:Object):Void {

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 22: Statement must appear within on/onClipEvent handler
my_FLVPlybk.addEventListener("complete", listenerObject);

Total ActionScript Errors: 4 Reported Errors: 4
 
Okay, so I have 1 layer with the instance my_FLVPlybk in the first frame. And in a second layer I paste the action script in the first frame.

For some reason after I do this the swf can no longer find the flv video it is suppossed to stream?
 
import mx.video.*;

var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
getURL(" _blank);
};
my_FLVPlybk.addEventListener("complete", listenerObject);
 
I can assure you that the script is fine. I just tested it and it opened your quiz page with login when the video is finished. Create a new FLA file with just one frame which only has FLVPlayBack Component and the script.

Kenneth Kawamoto
 
In all my tests I have not had the quiz page open after. I've tried numerous computers, turned off all popup blockers etc.

I created the new version as advised, here si a link to that test page:
I also added a link to download the fla and flv.

Please let me know why this isn't working for me!!!
 
OK I had a look, and it appears to be that your FLV does not always reach the end but stops just before. If it manages to reach the end it does open the quiz page, but if it doesn't (mostly doesn't) it won't. How did you create your FLV???

Anyway, that's not the end of the world. There are other techniques. Let's try using the cue points. Replace the script with the following:
Code:
import mx.video.*;

var cuePt:Object = new Object();
cuePt.time = 10;
cuePt.name = "end";
cuePt.type = "actionscript";
my_FLVPlybk.addASCuePoint(cuePt);

var listenerObject:Object = new Object();

listenerObject.cuePoint = function(eventObject:Object):Void  {
	getURL("[URL unfurl="true"]http://bewelldata.com/quiz1.htm",[/URL] _blank);
};
my_FLVPlybk.addEventListener("cuePoint",listenerObject);

listenerObject.complete = function(eventObject:Object):Void  {
	getURL("[URL unfurl="true"]http://bewelldata.com/quiz1.htm",[/URL] _blank);
};

my_FLVPlybk.addEventListener("complete",listenerObject);
It should open the quiz page when the video reaches 10 seconds mark. Change the value of "cuePt.time" to just under the duration of the video, so that the cue points will be fired just before the video ends.

Kenneth Kawamoto
 
Well that worked!!!!

I made the flv by importing video into flash and floowing their import directions.

Is your cue point Action Script transferrable to other videos or are the numbers specific to this video?

For my other videos should i be adding cue points when I create the flv?

What does the "10" reference in this case?

cuePt.time = 10;
cuePt.name = "end";

Thank you for your time and patience
 
Using Flash Video Encoder should create "normal" FLVs but videos generally are infamous for not reaching the very end...

You can add cue points when you're encoding your FLV, or add on runtime like I showed you. Of course the code is transferable. Just change the number for "cuePt.time". [tt]cuePt.time = 10;[/tt] means this cue point will be set at 10 seconds into the video. It can be any value such as [tt]cuePt.time = 625.178;[/tt], which is 10 minutes 25.178 seconds.

Kenneth Kawamoto
 
Hi,

I have exactly the same problem (except I wish to do a GoTo instead a GetURL). I read carefully your exchanges, understanding what was wrong and trying both methods : nothging works. The FLV plays, but no GoTo (or LoadMovie or whateverelse).

rvrtrnce removed the page where I could download the files, so I'm stuck.

Is it because its innapropriate with FLCS3 AS2?

Thx
 
Wow, thats a quick answer!

My code is yours.

Let me explain what I did :
-1 layer, only one frame with action (not on an object, directly on the frame)
-1 layer, only on frame, with my flv (imported with Flash)
-I renamed the flv to my_FLVPlybk or my_FLVPlbk, depending of the code I used
-And because I wasnt sure, I name the instance of the FLV my_FLVPlybk or my_FLVPlbk.

The result is the video plays, and go back to its first frame, but no action

rvrtrnce wrote “not_set_yet.addEventListener("complete",);“ in his 2nd email, do I need to do something with that?

Thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top