OK, heres de cómo hacer esto, tanto en AS3 y AS2
En primer lugar algunos conceptos básicos.
Yo Flash CS3 Video Encoder para codificar el archivo FLV para poder integrar mi cuepoints propia. Lo que les nombre no importa. Sólo asegúrese de ajustar la secuencia de comandos de acción de abajo para cuePoint el nombre que usted elija. En la mayoría de los casos malos poner uno al principio (como la navegación) y otro al final (como un evento). En este caso, llamé a la una al principio "empezar" y el otro al final "finalizado". Heres una captura de pantalla:
Su tanto más fácil de crear su propia cuepoints codificar el vídeo. Lamentablemente, a veces son sólo entregaron una FLV sin cuepoints. Afortunadamente, usted puede crear su propio código ActionScript. Ive nunca tuvo que hacerlo de esa manera, pero theres un montón de tutoriales por ahí que explicar cómo, si es necesario.
Una última nota - Recuerde que su FLV tiene que ser importada a la primera imagen de su línea de tiempo. Si usted no puede hacer eso en la película tendrá que crear en su propia película y después cargar la película en su principal.
Ahora que tengo mi FLV codificados con cuepoints añadido, basta con abrir un nuevo archivo de Flash en blanco (AS3 o AS2, lo que usted prefiera) y FLV a importar sus etapas con el componente FLVPlayback (requiere Flash 8 o superior).
Déle a su componente FLVPlayback cualquier nombre de la instancia que desee. En este caso he usado "my_FLVPlybk" (que podrás ver es bastante común, si alguna vez mirar a través titutos.)
Si usted está trabajando con ActionScript 3, en el mismo marco que el FLV agregue este código:
import fl.video.*;
//set up the cuepoint listener
my_FLVPlybk.addEventListener(MetadataEvent.CUE_POINT, cp_listener);
function cp_listener(eventObject:MetadataEvent):void {
//trace("Elapsed time in seconds: " + my_FLVPlybk.playheadTime);
//trace("Cue point name is: " + eventObject.info.name);
//trace("Cue point type is: " + eventObject.info.type);
//listen for the end cuepoint which I named "finished" during encoding
if (eventObject.info.name == "finished") {
var URLReq:URLRequest = new URLRequest("http://www.xmission.com/~emailbox/whycat.htm");
try {
//here's our redirect
navigateToURL(URLReq, "_self");
} catch (e:Error) {
trace(e);
}
}
}
- import fl.video.*;
-
- //set up the cuepoint listener
- my_FLVPlybk.addEventListener(MetadataEvent.CUE_POINT, cp_listener);
- function cp_listener(eventObject:MetadataEvent):void {
- //trace("Elapsed time in seconds: " + my_FLVPlybk.playheadTime);
- //trace("Cue point name is: " + eventObject.info.name);
- //trace("Cue point type is: " + eventObject.info.type);
-
- //listen for the end cuepoint which I named "finished" during encoding
- if (eventObject.info.name == "finished") {
- var URLReq:URLRequest = new URLRequest("http://www.xmission.com/~emailbox/whycat.htm");
- try {
- //here's our redirect
- navigateToURL(URLReq, "_self");
- } catch (e:Error) {
- trace(e);
- }
- }
- }
Si usted está trabajando con AS 2 Aquí está el código:
//to use getURL it has to be in an on or onClipEvent so we use onClipEvent (load)
onClipEvent (load) {
import mx.video.*;
//set up the cuepoint listener
var listenerObject1:Object = new Object();
listenerObject1.cuePoint = function(eventObject:Object):Void {
var cuePtName = eventObject.info.name; //variable for cuepoint name
//listen for the end cuepoint which I named "finished" during encoding
if (cuePtName == "finished") {
//do the redirect
getURL("http://www.xmission.com/~emailbox/whycat.htm", "_self");
//trace("Elapsed time in seconds: " + my_FLVPlybk.playheadTime);
//trace("Cue point name is: " + eventObject.info.name);
//trace("Cue point type is: " + eventObject.info.type);
}
};
my_FLVPlybk.addEventListener("cuePoint", listenerObject1);
}
- //to use getURL it has to be in an on or onClipEvent so we use onClipEvent (load)
- onClipEvent (load) {
- import mx.video.*;
-
- //set up the cuepoint listener
- var listenerObject1:Object = new Object();
- listenerObject1.cuePoint = function(eventObject:Object):Void {
- var cuePtName = eventObject.info.name; //variable for cuepoint name
- //listen for the end cuepoint which I named "finished" during encoding
- if (cuePtName == "finished") {
- //do the redirect
- getURL("http://www.xmission.com/~emailbox/whycat.htm", "_self");
-
- //trace("Elapsed time in seconds: " + my_FLVPlybk.playheadTime);
- //trace("Cue point name is: " + eventObject.info.name);
- //trace("Cue point type is: " + eventObject.info.type);
- }
- };
- my_FLVPlybk.addEventListener("cuePoint", listenerObject1);
- }
He añadido algunos comentarios para ayudar a explicar qué se está encendiendo.
El resultado final es el mismo en ambos casos:
AS 3 ejemplo AS 2 ejemplo (mis disculpas por la longitud del vídeo. Es el más corto que había disponible. Si usted no desea ver toda la cosa sólo tiene que utilizar el control deslizante para matorrales cerca del final - me puse a redireccionar a una página relacionada con el por qué gatos de hacer las cosas).