MediaPlayback scrubbing event

1. Drag a MediaPlayback instance onto the Stage.
2. Open the Component Inspector panel and enter an instance name of my_mp
3. Type in a URL to some FLV video of yours.
4. Open the Actions panel and paste the following code:

my_mp.addEventListener(“scrubbing”, scrubbingListener);
function scrubbingListener(evt_obj:Object):Void {
trace(evt_obj.type+” @ “+getTimer()+” ms (isScrubbing=”+evt_obj.detail+”)”);
trace;
}

5. Ctrl+Enter to test.
6. Scrub that video (that means drag the playhead). The Output panel will open and tell you where you scrub and true/false.

Don’t know if that’ll be useful to any of you or not, but there you are.

4 Responses to MediaPlayback scrubbing event

  1. brandon says:

    its always useful Jen. 🙂

  2. Richard T-J says:

    If you are using the separate MediaDisplay/MediaController components, you must target the MediaController component for this to function.Jen, great tip as always!

  3. joe jordan says:

    I just wish when you went backwards like to a previous cuePoint the MediaDiplay would fire events like the cuePoint method. I had to build my own mediaDisplay just to get around that. I did it by extending the FLVPlayer class in mx2004 pro which is what the MediaDisplay class is extending and from there I had to pretty much rewrite everything wrong with MM mediaDisplay component. I really hope MM fixes all the bugs.

  4. Carlos says:

    Joe,I find that when i scrub, the cuePoint event fires, but when i try and rewind to a previous cuePoint doesnt properly trigger, is that what you’re talking about? I found i had to work around it by subtracting a second when rewinding.[actionscript]function onClick(evt_obj:Object):Void {var cP:mx.controls.streamingmedia.CuePoint = my_md.getCuePoint(“two”);if (cP != null) {cP.display.play(cP.time – 1);//cP.display.pause();} else {trace(“unable to find specified CuePoint”);}}[/actionscript]i have a media display component with the instance name my_md, and the above function is used as an event listener on a button component. it starts playback at the “two” cue point which is at set 10 seconds, although calling play(10) usually goes to something weird like 10.118 seconds which is maybe why the cuePoint event isnt fired.Anyways, subtracting 1 from the seconds (so rewinding to 9) seems to do the trick.-c