Skip to main content
Agent_Starling
Participant
November 20, 2009
Question

Adding weblinks to flv video (like hotspots) - need help with this please

  • November 20, 2009
  • 1 reply
  • 605 views

Hi

I need to add 'mouseover' interactivity to an .flv video - here's what i need and what I'm guessing I should do, but don't know how as yet:

> I need to add mouse 'hotspots' to items in a video when the items appear. The hotspots would include external weblinks
>> My guess is that I could add cuepoints to the flv which dynamically load mc's from the library - the mc's would need to be invisible until mouseover wherein they animate/reveal a list of links.

I want to use an flv, not embed video into the fl, as I need to utilise flv streaming.


The mc mouseover would be bog standard stuff, but I just don't know how to call mc's from the library in an flv - if indeed this is the correct way to go about doing this ...

Can anyone advise me how to achieve this please???

Thanks in advance

This topic has been closed for replies.

1 reply

November 20, 2009

Cuepoints would be the way to go. You can add them using the Flash Video Encoder.. once you have an flv with cues you use the client property of the NetStream class to set a cue point handler method... something like:

myStream.client = { onMetaData:metaDataHandler, onCuePoint:cuePointHandler };

and then:

function cuePointHandler(infoObject:Object):void
{
     var cueName:String = infoObject.name;

Then you can test the cue name and add a clip from the library as needed:

if(cueName == "myCueName"){

     var vidButton = new myVideoButton();

     vidButton.x = 500;

     vidButton.y = 100;

     addChild(vidButton);

     vidButton.addEventListener(MouseEvent.CLICK, vidButton1Clicked, false, 0, true);

}

assuming you have a movie clip with a class name of myVideoButton in your library.

Agent_Starling
Participant
November 20, 2009

Many thanks for the reply!

I made a new mc in the library and gave it a class of myVideoButton - flash automatically added the Base class of: flash.display.MovieClip

I added your code to the root timeline (shown here with your comments stripped) but I think there was a closing brace missing so I added it and have marked below where I added it:

myStream.client = { onMetaData:metaDataHandler, onCuePoint:cuePointHandler };

function cuePointHandler(infoObject:Object):void

{

     var cueName:String = infoObject.name;

if(cueName == "myCueName"){

     var vidButton = new myVideoButton();

     vidButton.x = 500;

     vidButton.y = 100;

     addChild(vidButton);

     vidButton.addEventListener(MouseEvent.CLICK, vidButton1Clicked, false, 0, true); }

Closing brace added here >>> } <<<

Exported it and am getting the following errors:

**Error** Scene 1, Layer 'Layer 2', Frame 1, Line 19: 1120: Access of undefined property vidButton1Clicked.
     vidButton.addEventListener(MouseEvent.CLICK, vidButton1Clicked, false, 0, true); }

**Error** Scene 1, Layer 'Layer 2', Frame 1, Line 3: 1120: Access of undefined property myStream.
     myStream.client = { onMetaData:metaDataHandler, onCuePoint:cuePointHandler };

**Error** Scene 1, Layer 'Layer 2', Frame 1, Line 3: 1120: Access of undefined property metaDataHandler.
     myStream.client = { onMetaData:metaDataHandler, onCuePoint:cuePointHandler };

Total ActionScript Errors: 3,  Reported Errors: 3

Do you have any ideas as to what could remedy this?

Thanks

November 20, 2009

I just gave an example, it was not meant to be complete. The errors are telling you the problems:

1. You don't have a vidButton1Clicked function to be called when the button is clicked.

2. You need a NetStream instance (I called it myStream for example) to play your video.

3. You did not define a metaDataHandler function...

You need to read up on playing video. Have a look in the Help at the NetStream, NetConnection and Video classes. There's good examples that should get you started.