Flash flv question
- Started
- Last post
- 12 Responses
- theplanet
I want my timeline to play at the end of my flv. I have been working on this all day yesterday and I cant figure it out.
I dont need anything else to happen just when the flv is done playing I want my root timeline to go to frame 5.
Any advice would be appreciated.
Josh
- skt0
How is your flv encoded? You can put meta data into it and then read that back in flash. It also depends on what your using to play your flv in flash.
- milo0
there's really good flv tutorial on
http://www.gotoandlearn.com/it's in 5 parts 'Video basics' the tute has a playhead on it that you could monitor to trigger other stuff..
I found it really helpful.
- theplanet0
I just used the default setting in sorenson squeeze.
Im just using the netconnection script to load the movie.
here is my code
stop();
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.play("text_large.flv");
//ns.setBufferTime(20);
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded:Number;thanks for any advice you have
Josh
- davi-t0
embed FLV into movieclip, give movieclip an instance name, (ie. "flv_mc") attach code on _root to check when the FLV mc is done playing and then tell root to go to frame 5 when flv_mc has reached its last frame.
ie:
flv_mc.onEnterFrame=function(){
if (flv_mc._currentframe == flv._totalframes){
flv_mc.stop();
_root.gotoAndStop(5);
delete flv_mc.onEnterFrame;
}
- davi-t0
minus my spelling mistakes :P
sorry early over here..
- theplanet0
milo, I went through those tutorials yesterday, they are great, but I couldnt find anything to help me do exactly what Im trying to do.
Do you remember which tutorial specifically has info for what i want to do?
Josh
- theplanet0
thanks davi-t Ill try that.
Josh
- skt0
this.onEnterFrame = function() {
nsTime = (ns.time+0.1);
_global.nsLoadTime = nsTime;
if ((nsTime>=ns.totalTime) && (nsTime>1)) {
trace("film has ended");
// do whatever
this._parent.gotoAndPlay("finish...
break;
}
}
- milo0
sorry Josh, i can't remember which one! I do remember thinking at the time though that anything that returns the flv's progress could be used to trigger stuff while the .flv is playing.
Sounds like some of the other's above have answered
your question though.. : )
- theplanet0
skt-
thanks for that code, I think its just what I need.when I run it I keep getting an error:
**Error** Symbol=flv_mc, layer=Layer 2, frame=1:Line 25: There is no property with the name 'totalTime'.
if ((nsTime>=ns.totalTime) && (nsTime>1)) {if I use media.totalTime it doesnt have the error , but it also doesnt work. Any suggestions?
Thanks again
Joshps milo thanks for the help anyway
- davi-t0
Use my code. There is no such property as totalTime unless u create the object and specify the total time as a method of the object. My code is the same thing except _totalframes 'is' a property of a Movieclip object.
skt's does the same thing as mine basically, his uses a little more code than u need and prolly isn't as accurate at checking when the FLV is done (ie. his is time-based). If you are loading the FLV straight into the SWF dynamically, load it into an empty mc using this.createEmptyMovieclip(mcName etc etc); then load FLV directly into that mc..then check the mc props.
- skt0
Sorry mate. Missed out this bit.
ns.onMetaData = function(obj) {
// Retrieve duration meta data
this.totalTime = obj.duration;
// set the right size for the videodisplay if metadata is found};
Does need to be encoded with meta data though. Squeeze should do it no bother.