|
Step 5. Adding Events |
Top Previous Next |
|
In this section you can add events to your movie. Both SWF and FLV output format supports event. However they work a little bit different. An event or a cue point is a marker which you can put throughout the video. An event will get executed whenever the video playback reach the time when the event is defined. You can attach two types of action into an event. A Load SWF which loads another SWF file on top of your video. And an Open URL which can be used to to load a specific URL into a current browser window or a new popup browser window.
Adding an event To add an event, simply drag the video playback slider to your desired time when the event will occur and click Add button. To move the video playback slider at a higher acuracy you can use the Fine search bar. Drag it left to slowly move the video playback slider backwards and vice versa. The further you drag the fine search bar, the faster the video playback slider will move. Note that you can only have one event at one time. Adding a new event at the same time will overwrite an existing event.
Naming an event You can name an event by typing in at the Name textbox. Make sure you give a unique name to each event. During playback, Flash Player will pass the name of an occuring event by its name to your movie event listener.
Delete To delete the currently selected event
Set to current To set the current event time to the current video playback slider.
Only execute action once When it is checked, each event will only execute once. When the video is replaying from the beginning, all already executed events wont be executed any longer.
Load an SWF movie at... To load an SWF movie on top of your video when this event occured. Type in the SWF movie URL at the textbox underneath it.
X, Y A coordinates where the SWF movie should be loaded.
SX, SY A scaleX and scaleY which will be applied to the loaded SWF movie
Keep aspect ratio To enable/disable scale aspect ratio
Open URL at... To open a URL when this event occured. Type in the URL at the textbox underneath it.
Note that Flash Player may blocks the open URL command if it tries to load a URL from a different domain than your main movie. Eg: Your main movie is located at http://www.mywebsite.com/main.html and the open URL is set to product.html. This scenario should work fine as product.html is located at the same domain as your main movie at http://www.mywebsite.com
Your main movie is located at http://www.mywebsite.com/main.html and the open URL is set to http://www.friendwebsite.com/product.html. This scenario may cause Flash Player to block the open URL executation.
Target The URL target window
Handling your own event (advanced user) For an advanced user who wants to do more than just openURL/loadMovie, you can also handle your own event and do any action accordingly by importing the FLV video into Macromedia Flash authoring tools.
When you publish your video as an FLV file, all events will also be exported into a standard Macromedia Flash Video netstream event. This allow you to capture the event the same way as you would capture an event from FLV created with Macromedia Flash which has cue points.
The example code below shows you an example how to capture the FLV event. A full FLA implementation of this example is also included at [Program Files]/Flash Video Studio 2.0/Examples/NetStreamEventListener.fla. Please change the FLV file path c:\\fvs.flv into the path to your FLV file.
var vid_mc:Video; var con_nc:NetConnection = new NetConnection(); con_nc.connect(null); var vid_ns:NetStream = new NetStream(con_nc);
vid_mc.attachVideo(vid_ns); vid_ns.play("c:\\fvs.flv");
vid_ns.onCuePoint = function(infoObject:Object){ trace("onCuePoint:"); for (var propName:String in infoObject) { if (propName != "parameters") { trace(propName + " = " + infoObject[propName]); } else { trace("parameters ="); if (infoObject.parameters != undefined) { for (var paramName:String in infoObject.parameters) { trace(" " + paramName + ": " + infoObject.parameters[paramName]); } } else { trace("undefined"); } } } trace("---------"); }
Apart from exporting a Macromedia Flash netstream event, Flash Video Studio also make a call to _parent.onFVSEvent(name, time). name is the name of the event while time is the time when the event is occured. Note that this is only available when your are publishing your video with a control. Both SWF and FLV format supports this feature.
To be able to make use of this feature, simply create a function called onFVSEvent with name and time as parameters at the parent of movie clip where you load your FLV video. This function will be called whenever an event occured. |