How to dispatch event-cuePoint in panoramic video?

Using Pano2VR/Object2VR SWF files with your own Flash projects
Post Reply
Sascha Selent
Posts: 28
Joined: Sat Jan 24, 2009 9:36 pm

Hi.

The title says it: I´m trying to execute a function controlled by a cuePoint from a panoramic video.

I managed to load a panoramic video with a button.
I can play / pause the video with a button.

Now I´m trying to call a function with a cuePoint in the video, but I don´t know where to add the eventListener.

In the tracer I see that video-infos are traced (e.g. MetaData AND cuePoints), but I can´t see what is shooting the cuePoint-event.

I tried to dispatch the cuePoint in the video adressing the "vr.pano.video.stream", but it does not work.

Using Pano2VR 2.3.4 with Flash CS3.

Here is the code:

Code: Select all

import flash.display.*;
import flash.net.URLRequest;
import flash.events.Event;
var loader:Loader;
loader = new Loader();
var url:String = "flur_zu_kueche_p2vr2.swf";
var urlReq:URLRequest = new URLRequest(url);
var vr:MovieClip;// panorama movieclip

// This is done after the swf is loaded.
function finished_loading(e:Event) {
}

function initHandler(event:Event):void {
	trace("initHandler: " + event);
	vr = MovieClip(loader.content);// cast 'DisplayObject' to 'MovieClip'
	vr.isFlash10=false;// Disable Flash 10 rendering if the container is Flash 9
}

function initPanorama(e:Event) {
	// check if the panorama object is available and initialize it
	if ((vr!=null) && (vr.pano!=null)) {
		removeEventListener( Event.ENTER_FRAME , initPanorama);
		vr.pano.setWindowSize(900,500);// resize the window
		vr.pano.setWindowPos(0,0);// reposition
	}
}
// call initPanorama every frame
addEventListener( Event.ENTER_FRAME , initPanorama);

// Tell the loader to call 'finished_loading' after the swf is loaded.
loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, finished_loading);
// Tell the loader to call 'initHandler' after the swf is initialized.
loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
loader.load(urlReq);
addChild(loader);// add your swf directly to the stage

//----------
import flash.events.MouseEvent;

function loadVideo(event:MouseEvent):void {
	vr.attachVideo('<video url="flur_zu_kueche_2046_800_kf1_cp.flv"/>');
	trace("ÖÖÖÖÖÖÖÖÖÖÖÖÖ + "+vr.pano.video.stream);
	vr.pano.video.stream.addEventListener("onCuePoint", testHandler);
}
videoButton.addEventListener(MouseEvent.CLICK, loadVideo);

function testHandler(event:Event) {
	trace("XXXXXXXXXXXXXXXXXXXX", event);
}

//----------
function pauseVideo(event:MouseEvent):void {
	vr.pano.video.stream.pause();
}
pauseButton.addEventListener(MouseEvent.CLICK, pauseVideo);
I attached all files including video if someone wants to test. I added a pano done with Pano2VR 3 if someone wants to test with cs4 or later.

If someone could help it would be great.

Thanks.

Sascha
Attachments
vr_video_test.zip
(3.19 MiB) Downloaded 2855 times
Post Reply