Active links in .flv video?

I have someone asking me to convert their flash movie into a .flv file for use on their web site. This I can do myself. But now they want the links from the original .swf to be active in the .flv file too. The movie is just a series of 5 slides and each slide links to a different URL.

I’ve scoured the web for an answer but haven’t seen what I’m looking for, or at least a better explanation that I can understand. I saw one possible solution here:

adding links to flv - ActionScript.org Forums

But this code goes in the flash movie that loads the .flv video, yes?

This is what I’m working with so far:

var my_ns:NetStream = new NetStream(my_nc);
my_video.attachNetStream(my_ns);
my_ns.play("fh_video_0611.flv"); 

var myTimeArray:Array = new Array(.01,3.70,7.30,11.10,14.66) 
var myLinkArray:Array = new Array("http://www.flairhair.com/original-visors.html","http://www.flairhair.com/gift-basket.html","http://www.flairhair.com/bandanas.html","http://www.flairhair.com/licensed-sports-visors.html","http://www.flairhair.com/ladys-accessories.html") 
var myLink:String = myLinkArray[0]

var currentLinkNum:Number = 0;

var time_interval:Number = setInterval(checkTime, 100, my_ns); 
function checkTime(my_ns:NetStream) {     
	var ns_seconds:Number = my_ns.time;     
	trace(my_ns.time)     
	var minutes:Number = Math.floor(ns_seconds/60);     
	var seconds = Math.floor(ns_seconds%60);     
	if (seconds<10) {     
		seconds = "0"+seconds;     
	} 
//display the text   
	var time_txt;
	time_txt.text = minutes+":"+seconds;     
	if(my_ns.time > Number(myTimeArray[currentLinkNum+1])){         
		currentLinkNum++         
		myLink = myLinkArray[currentLinkNum];             
		}     
		
trace(myLink);

}

I am getting these errors however, which I don’t understand:

TypeError: Error #1010: A term is undefined and has no properties.
at video_container_fla::MainTimeline/checkTime()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback onMetaData. error=ReferenceError: Error #1069: Property onMetaData not found on flash.net.NetStream and there is no default value.
at video_container_fla::MainTimeline/frame1()
Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback onXMPData. error=ReferenceError: Error #1069: Property onXMPData not found on flash.net.NetStream and there is no default value.
at video_container_fla::MainTimeline/frame1()

I solved the errors by suppressing the Async Error, and I also added a text area component with an instance name of time_txt (whoops!). Now I just have to figure out how to assign the URLs in the array to an invisible button as the video progresses.

import flash.media.Video;


var my_nc:NetConnection = new NetConnection();
my_nc.connect(null);

var my_ns:NetStream = new NetStream(my_nc);
my_ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
my_ns.play("fh_video_0611.flv"); 

var my_video:Video; 


my_video.attachNetStream(my_ns);

function asyncErrorHandler(event:AsyncErrorEvent):void {}


var myTimeArray:Array = new Array(0.10,3.70,7.30,11.10,14.66) 
var myLinkArray:Array = new Array("http://www.flairhair.com/original-visors.html","http://www.flairhair.com/gift-basket.html","http://www.flairhair.com/bandanas.html","http://www.flairhair.com/licensed-sports-visors.html","http://www.flairhair.com/ladys-accessories.html") 
var myLink:String = myLinkArray[0]

var currentLinkNum:Number = 0;

var time_interval:Number = setInterval(checkTime, 500, my_ns); 
function checkTime(my_ns:NetStream) {     
	var ns_seconds:Number = my_ns.time;
	trace(myLink);
	trace(my_ns.time);     
	var minutes:Number = Math.floor(ns_seconds/60);     
	var seconds = Math.floor(ns_seconds%60);     
	if (seconds<10) {     
		seconds = "0"+seconds;     
	} 
//display the text   

	time_txt.text = minutes+":"+seconds;     
	if(my_ns.time > Number(myTimeArray[currentLinkNum+1])){         
		currentLinkNum++ ;        
		myLink = myLinkArray[currentLinkNum];             
		}     
		
trace(myLink);

}

stop();

Thanks for letting me work my issues out on your boards! :wink:

import flash.media.Video;
import flash.net.URLVariables;


var my_nc:NetConnection = new NetConnection();
my_nc.connect(null);

var my_ns:NetStream = new NetStream(my_nc);
my_ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
my_ns.play("fh_video_0611.flv"); 

var my_video:Video; 


my_video.attachNetStream(my_ns);

function asyncErrorHandler(event:AsyncErrorEvent):void {}


var myTimeArray:Array = new Array(0.10,3.70,7.30,11.10,14.66) 
var myLinkArray:Array = new Array("http://www.flairhair.com/original-visors.html","http://www.flairhair.com/gift-basket.html","http://www.flairhair.com/bandanas.html","http://www.flairhair.com/licensed-sports-visors.html","http://www.flairhair.com/ladys-accessories.html") 
var myLink:String = myLinkArray[0]

var currentLinkNum:Number = 0;

var time_interval:Number = setInterval(checkTime, 500, my_ns); 
function checkTime(my_ns:NetStream) {     
	var ns_seconds:Number = my_ns.time;
	trace(myLink);
	trace(my_ns.time);     
	var minutes:Number = Math.floor(ns_seconds/60);     
	var seconds = Math.floor(ns_seconds%60);     
	if (seconds<10) {     
		seconds = "0"+seconds;     
	} 
//display time with TextArea component with instance name of time_txt

	time_txt.text = minutes+":"+seconds;     
	if(my_ns.time > Number(myTimeArray[currentLinkNum+1])){         
		currentLinkNum++ ;        
		myLink = myLinkArray[currentLinkNum];             
		}     
		
trace(myLink);

//assign URL to button depending on time interval

my_btn.addEventListener(MouseEvent.CLICK, destination);
function destination(event:MouseEvent):void {
  var destination_req:String = myLink;
  var request:URLRequest = new URLRequest(destination_req);
  try {
    navigateToURL(request, '_self');
  } catch (e:Error) {
    trace("Error occurred!");
  }
}

}

//Loop video when it completes
my_ns.addEventListener(NetStatusEvent.NET_STATUS, NCListener);
function NCListener(e:NetStatusEvent){
if (e.info.code == "NetStream.Buffer.Empty") {
my_ns.play("fh_video_0611.flv");
}
}; 
stop();