Dispatch a 'cuePoint' event when a seek occurs.
Also listen for the 'ready' event, and add cuePoints in the event handler.


import mx.utils.Delegate;
//
function buttonReleaseHandler() {
 trace("Application ::: buttonReleaseHandler");
 var cp:Object = _player.findCuePoint("cuePt8");
// create props to send along with cuePoint event
 var tmp:Object = {time:cp.time, name:cp.name, parameters:cp.parameters};
 _player.seek(cp.time);
 _player.dispatchEvent({type:"cuePoint", info:tmp});
}
//
function cuepointHandler(evt:Object) {
 trace("Application ::: cuepointHandler");
 trace("    - name: "+evt.info.name);
}
//
function readyHandler(evt:Object) {
 trace("Application ::: readyHandler");
 _player.addASCuePoint(1, "cuePt1");
 _player.addASCuePoint(8, "cuePt8");
}
//
_btn.onRelease = Delegate.create(this, this.buttonReleaseHandler);
_player.addEventListener("cuePoint", Delegate.create(this, cuepointHandler));
_player.addEventListener("ready", Delegate.create(this, readyHandler));
_player.contentPath = "film.flv";

regards,
Muzak

----- Original Message ----- 
From: "til" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, September 20, 2006 1:53 AM
Subject: [Flashcoders] FLVPlayer and addASCuePoint


> Hello everyone. After a long hiatus from this list, I decided to
> resubscribe, becasue i am at my wit's end :(
>
> Thankfully, chattyfig has some of the world's best AS coders so I'm
> sure this is no problem for you people. Here goes:
>
> I got a FLVplayer (flash 8 pro) instance and loaded an flv that has no
> cuepoints encoded. I really don't want to encode cuepoints, but use AS
> to create them.
>
> The code below works fine: it moves the playback to 8secs into the film.
>
> BUT! --> here is the problem! <-- the trace action I have set for that
> cuepoint JUST WONT EXECUTE.
>
> The only way I can make it show is to seek to about 3 secs before my
> cuepoint, but obviously that also plays the film 3 secs earlier.
>
> I tired using seekToNavCuePoint() but that doesn't do anything, not
> even moves playback header.
> What else could I try? Again ,the video jumps as expected, but the
> action isnt happening.
>
> // load file
> Vid1.contentPath = "film.flv";
>
> // cue point listening
> var listnerObject:Object = new Object();
> listnerObject.cuePoint = function(eventObject:Object):Void  {
> cuepointers(eventObject); // calling function below
> }
> Vid1.addEventListener("cuePoint", listnerObject);
>
> // make cuepoints
> Vid1.addASCuePoint(1,"cuePt1");
> Vid1.addASCuePoint(8,"cuePt8");
>
> // button to seek to a specific cuepoint
> btn1.onPress = function(){
> Vid1.seek(Vid1.findCuePoint("cuePt8")["time"]);
> }
>
> // my function to do something when the cuepoint is hit
> function cuepointers(eventObject){
>    switch(eventObject.info.name){
> case "cuePt1" :
> trace("cue1");
> break;
> case "cuePt8" :
> trace("cue8"); // here! this action just wont happen :(
> break;
> default : break;
>    }//end switch
> }


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to