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
 
Hi Kenneth,

The file inserted in my Flash is called FLVPlaybak.flv

I just realized its not the same as the component.

Wow, thats a world of difference!

Now :
-how can I link the component with my my video?
-Do I need to insert a CuePoint in the component?
-And how can I remove the components buttons?

(Flash is a fantastic software, but some times, simple things are so complicated LOL)

Thx
 
Hi Kenneth,

forgot my last post : It worked!!!

Don't really know what's teh difference, I restart from the beginning and its OK.

Many thanks
(I searched a lot about that, and the actuel thread is the most comprehensive)
 
Hi Kenneth,

since I've got your code, my life is better LOLL

SO of course, I decided to trick it a little bit, and add a second event.

So I used two cue ponts, called “part¥ and “magog, which are the name of the MC I want to be played on CuePoints

Sorry I use TellTarget, which is outdated but, it worked heh!

Both MCs (party and magog) are playing at the same time (14), instead playing party at 14 and magog at 19.

And they always replay

import mx.video.*;

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

var listenerObject:Object = new Object();

listenerObject.cuePoint = function(eventObject:Object):Void {
tellTarget ("party") {
gotoAndPlay(2);
}
};
my_FLVPlybk.addEventListener("cuePoint",listenerObject);

listenerObject.complete = function(eventObject:Object):Void {
tellTarget ("party") {
gotoAndStop(2);
}
};

my_FLVPlybk.addEventListener("party",listenerObject);

//magog
var cuePt2:Object = new Object();
cuePt2.time = 19;
cuePt2.name = "magog";
cuePt2.type = "actionscript";
my_FLVPlybk.addASCuePoint(cuePt);

var listenerObject:Object = new Object();

listenerObject.cuePoint = function(eventObject:Object):Void {
tellTarget ("magog") {
gotoAndPlay(2);
}
};
my_FLVPlybk.addEventListener("cuePoint",listenerObject);

listenerObject.complete = function(eventObject:Object):Void {
tellTarget ("magog") {
gotoAndPlay(2);
}
};

my_FLVPlybk.addEventListener("magog",listenerObject);
 
You do not set up a function for each cuePoint; you can only have one (and only need one) function.
Code:
listenerObject.cuePoint = function(eventObject:Object):Void {
   switch(eventObject.info.name){
      case "party":
         trace("Cue point 'party'");
         break;
      case "magog":
         trace("Cue point 'magog'");
         break;
   }
}
Also there are no Events such as "magog" in FLVPlayback (unless you write your own Class with custom Event) so you cannot add "magog" event to the Listener!

Kenneth Kawamoto
 
You tell Flash what to do on cuePoint. In the example above:

[tt]case "party":
trace("Cue point 'party'");
break;[/tt]

...you are telling Flash to trace() when it encounters the cuePoint called "party".

Kenneth Kawamoto
 
wow, that link is full of info!

I'm checking it out. (even if, honestly, I don't really understand all those codes)

BTW, I'm confused with AS or Embedded cuepoints.

I created my cuepoints with the video encoder interface, nd I'm wondering if the AS cuepoints interfers with the “native“ ones
 
Hi, its me again,

I found that way to do what I want. In this example, it writes seconds when cuepoints occurs. I added the GetUrl to yahoo. But I cannot tell two differnt action. Yahoo for cuePt #1 and google for cuePt #2

CODE
var my_flvPb:mx.video.FLVPlayback;
my_flvPb.contentPath = "hans.flv";


var cuePt:Object = new Object();
cuePt.time = 14;
cuePt.name = "elapsed_time";
cuePt.type = "actionscript";

my_flvPb.addASCuePoint(cuePt);


my_flvPb.addASCuePoint(19,"elapsed_time2");


var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject) {
my_ta.text += "Elapsed time in seconds: " + my_flvPb.playheadTime + "\n";
getURL(" "_blank");
};
my_flvPb.addEventListener("cuePoint",listenerObject);
 
Condition the getURL with a range of seconds...

var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject) {
my_ta.text += "Elapsed time in seconds: " + my_flvPb.playheadTime + "\n";
if(my_flvPb.playheadTime > 10 && my_flvPb.playheadTime <12){
// between 10 & 12 seconds...
// Of course replace with a range closer to what you have...
getURL(" "_blank");
}else{
getURL(" "_blank");
}
};
my_flvPb.addEventListener("cuePoint",listenerObject);



Regards. FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING
 
it was “that“ simple? LOL

thx.

Now, I have a 3rd cuePt to add, so the “else if“ doesn't work.

In fact, I need one at 19 and one at 22. So just a “else if“is not accurate enough.

Sigh...
 
LOL,

you dont have anymore advice?

I have no idea how to create the 3rd cuePt, and have no idea either how to put a delay.

Sigh, this is me the old newbie :-/
 
I tried that, and only the 1st one is working :


CODE
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject) {
if (my_flvPb.playheadTime>13 && my_flvPb.playheadTime<14) {
tellTarget ("party") {
gotoAndPlay(2);
}
}
if (my_flvPb.playheadTime>16 && my_flvPb.playheadTime<17) {
tellTarget ("magog") {
gotoAndPlay(2);
}
}
if (my_flvPb.playheadTime>20 && my_flvPb.playheadTime<21) {
tellTarget ("bureau") {
gotoAndPlay(2);
}
}
};
my_flvPb.addEventListener("cuePoint", listenerObject);
 
Yikes, I've tried both the cuepoint and the plain old end of video method and neither works. No errors, no nothing, it just fails to bring up or to try to bring up a page. What gives?
 
Actually, one more bit of info, I use sorenson squeeze to encode videos, and using the geturl options in that program, I was successful in jumping to the page. But I need a transparent video (I've encoded with VP6, capable of native alpha) and for some reason sorenson creates an .swf that always has a white background. Now I'm noticing the same thing when I try to do it manually in flash. How can I get around this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top