FORUMS: list search recent posts

Using Cue Points to advance to next scene

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ray Campbell
Using Cue Points to advance to next scene
on Feb 24, 2010 at 4:26:07 pm

I'm pretty new to AS3. I'm a designer trying to do it myself.

What I'm trying to do is use a cue point at the end of my FLV (which is loaded using ui loader in my flvSWF) to go to the next scene in my mainSWF file.

here's the code I'm using in my flvSWF:


import fl.video.VideoEvent;
import fl.video.MetadataEvent;


IntroMovie.addEventListener(MetadataEvent.CUE_POINT, cp_listener);
function cp_listener(eventObject:MetadataEvent):void {
trace("Elapsed time in seconds: " + IntroMovie.playheadTime);
trace("Cue point name is: " + eventObject.info.name);
trace("Cue point type is: " + eventObject.info.type);

if (eventObject.info.name == "CueNextScene") {
this.gotoAndPlay("desk");
}

}


But of course it does not work.

A. my traces don't show up.
B. Am I suppose to use this code in my mainSWF instead of the flvSWF
C. An FYI the intro movie is one of 4 random movies that gets played for the intro. The random script works fine.

PLEASE HELP.

Ray


Return to posts index

demetri tashie
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 12:39:41 am

a few thoughts:

a) not sure why you are using eventObject. try using just event for the listener and the function

b) is IntroMovie the video player? the listener needs to be added to the video player, not the video itself.

c) are you using a FLVPlayback component ??

d) make sure that the cue point is an event type cue point and not a navigation type cue point

e) review some old posts and tutorials on cue points - there is some good info out there


Return to posts index

Ray Campbell
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 12:54:09 am

First of all, thanks a bunch for responding!
It's people like you that are a great service to building better sites.

Anyways:

a. I'm using event object because I borrowed this code from another source...obviously the wrong source.

b. IntroMovie is the name of the flv playback component.

c. yes

d. and it is an event cue point that i made with the media encoder.



code: still not working:


import fl.video.VideoEvent;
import fl.video.MetadataEvent;


IntroMovie.addEventListener(MetadataEvent.CUE_POINT,cp_listener);
IntroMovie.play();
function cp_listener(event:MetadataEvent):void
{
trace("Elapsed time in seconds: " + IntroMovie.playheadTime);
trace("Cue point name is: " + event.info.name);
trace("Cue point type is: " + event.info.type);
IntroMovie.stop();
}


Return to posts index


demetri tashie
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 2:52:58 am

well,
i just did a small test, and it all works fine.

silly question, do you have a source set for the video? with my video "lucy1.flv"

it worked fine:

import fl.video.VideoEvent;
import fl.video.MetadataEvent;

IntroMovie.source="lucy1.flv";


IntroMovie.addEventListener(MetadataEvent.CUE_POINT,cp_listener);
IntroMovie.play();
function cp_listener(event:MetadataEvent):void
{
trace("Elapsed time in seconds: " + IntroMovie.playheadTime);
trace("Cue point name is: " + event.info.name);
trace("Cue point type is: " + event.info.type);
IntroMovie.stop();
}




Return to posts index

Ray Campbell
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 3:02:39 am

This is my entire code:

The trace still does not show up.
The f4v plays (using "1" because its 1 of 4 that randomly gets chosen)
I've set cue points with encoder and the inspector recognizes it...but still does not work. am i missing additional code? remember, i'm a newb!


import fl.video.VideoEvent;
import fl.video.MetadataEvent;


IntroMovie.source="1.f4v";

IntroMovie.addEventListener(MetadataEvent.CUE_POINT,cp_listener);
IntroMovie.play();

function cp_listener(event:MetadataEvent):void {
trace("Elapsed time in seconds: " + IntroMovie.playheadTime);
trace("Cue point name is: " + event.info.name);
trace("Cue point type is: " + event.info.type);
IntroMovie.stop();
}


Return to posts index

Ray Campbell
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 1:06:04 am

Also, tried to do a search on Cue Points but nothing relevant shows up.

Also, looked in my component inspector and my Cue Point does show up with the righting timing. so it is being recognized by the comp inspector. it's just not tracing any of the metadata.


Return to posts index


demetri tashie
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 3:21:59 am

well, as i said, it is working with my test flvs

do you want to zip your .f4v up and i'll do a test with that?




Return to posts index

Ray Campbell
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 4:01:34 am

okay...i figured it out. it has to be an flv not a f4v. although i thought it was the same thing. but evidentally not.

but now i have another problem. i have the code in my random movie swf that loads into my main SWF.

how do I use the cue to make it call upon a scene/frame in my main SWF.

do i put a function in my main SWF to recognize the randomMovie SWF's cue or do i keep the function in my randomMovie SWF?

I hope that makes sense.



Return to posts index

Ray Campbell
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 4:12:47 am

so basically can a randomly loaded SWF with a ui loaded flv live within a MainSWF and then call upon a frame within that MainSWF?

if so, do i put the conditional function within the randomly loaded SWF or the MainSWF?


Return to posts index


demetri tashie
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 4:23:53 am

you don't want the code in the external swf at all.

it goes in the main swf.

you've jsut compounded your question, because this is actually playing in an externally loaded swf.

so first you have to take care of telling the compiler that the content of the loader is actaully a movieclip, and then you have code in the main swf to listen for the video's cue point on the player in the external swf, which triggers the function to tell the main swf to go to a scene or frame or whatever else you want.

please refer to the current thread for more information on how to code that as i just can't write it again .....
http://forums.creativecow.net/readpost/190/866516

let us know how it is progressing


Return to posts index

Ray Campbell
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 5:37:24 am

Okay, so i have attached this code into my mainSWF and it works great. Even the cue works which it advances to the frame called "desk".

Now what I need to happen is load one of four videos randomly.
do I use the FLVplayback component to do this...or do I do it using the UI loader?



stop();

import fl.video.VideoEvent;
import fl.video.MetadataEvent;

IntroMovie.addEventListener(MetadataEvent.CUE_POINT,cp_listener);
IntroMovie.play();
function cp_listener(event:MetadataEvent):void
{
trace("Elapsed time in seconds: " + IntroMovie.playheadTime);
trace("Cue point name is: " + event.info.name);
trace("Cue point type is: " + event.info.type);

if (event.info.name == "CueNextScene") {
this.gotoAndPlay("desk");
}
}


Return to posts index

demetri tashie
Re: Using Cue Points to advance to next scene
on Feb 25, 2010 at 12:31:24 pm

UI Loader ? no - since you are using a flvPlayback component, that is all you need.

just assign the source of the component with a random math statement - it will be easiest if you have your video names stored in an array


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]