View Full Version : Need help creating FLVPlayback Time Function for Streaming Video
melaniemagic
01-12-2006, 02:31 PM
Hi all:
I am very new to action scripting and I really need some help. I have a movie streaming from a FCS to the main site. I am using Flash 8 and a custom FLV skin.
Need major help creating a timer that reads how much of the FLV has played. They had this included in the MX controls but I guess its all script in Flash 8.
Any help would be welcomed!!!
Thanks,
M
cancerinform
01-12-2006, 03:23 PM
First consult the flash help files. All is written there. This is what I got from there:
/**
Requires:
- FLVPlayback component on the Stage with an instance name of my_FLVPlybk
*/
import mx.video.*;
var listenerObject:Object = new Object();
listenerObject.stateChange = function(eventObject:Object):Void {
trace(my_FLVPlybk.state + ": playhead time is: " + my_FLVPlybk.playheadTime);
};
my_FLVPlybk.addEventListener("stateChange", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
melaniemagic
01-12-2006, 03:48 PM
hi cancer:
thanks for the direction. i did that tut previously and it gave me the information in the out put window. i want to make a dynamic counter on the flv controls that reads:
0:00 - 7:53
saying that 0 of the movie has played and 7:53 is the total size of the movie.
sorry if this is remedial for everyone here, but im having a difficult time with figuring out how to make it work!
thanx.
m
cancerinform
01-12-2006, 04:04 PM
Put a textarea on stage and call it myText and this script:
import mx.video.*;
var myText:mx.controls.TextArea;
var listenerObject:Object = new Object ();
listenerObject.stateChange = function (eventObject:Object):Void {
myText.text = my_FLVPlybk.playheadTime+" - "+my_FLVPlybk.totalTime;
};
my_FLVPlybk.addEventListener ("stateChange", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
melaniemagic
01-12-2006, 07:51 PM
Thank you so much the code works great but right now the state changes only a couple times. How do I get it to update the display more often (every half second, for ex)?
Thanks!
M
cancerinform
01-12-2006, 11:06 PM
This is the code Macromedia provides. You cannot change anything as far as I know. You can try a _root.onEnterFrame event.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.