Hi,
I’m having a problem loading an FLV file via the NetStream object.
The following is on frame 1 of my root timeline:
loadMovieClip();
function loadMovieClip():Void {
// Create new NetConnection object
var netConn:NetConnection = new NetConnection();
netConn.connect(null);
// Create new streaming object and attach the NetConnection object
var netstream:NetStream = new NetStream(netConn);
_root.bgVideo.attachVideo(netstream);
netstream.setBufferTime(5);
netstream.play("champcrash.flv");
netstream.onStatus = function(infoObject:Object) {
trace("NetStream.onStatus called: ("+getTimer()+" ms)");
for (var prop in infoObject) {
trace(" "+prop+": "+infoObject[prop]);
}
trace("Loaded: " + this.bytesLoaded);
trace("bytesTotal: " + this.bytesTotal);
trace("");
};
};
Nothing too complicated there… its just loading ‘champcrash.flv’ into the ‘bgVideo’ object on the stage. My problem is that with the code as above, the video is paused on the first frame, and doesn’t progress.
The odd thing is, if I take the contents of the ‘loadMovieClip’ function, and just place it on the same frame, without any function or function call, then the video will play correctly, without pausing. Code looks like:
// Create new NetConnection object
var netConn:NetConnection = new NetConnection();
netConn.connect(null);
// Create new streaming object and attach the NetConnection object
var netstream:NetStream = new NetStream(netConn);
_root.bgVideo.attachVideo(netstream);
netstream.setBufferTime(5);
netstream.play("champcrash.flv");
netstream.onStatus = function(infoObject:Object) {
trace("NetStream.onStatus called: ("+getTimer()+" ms)");
for (var prop in infoObject) {
trace(" "+prop+": "+infoObject[prop]);
}
trace("Loaded: " + this.bytesLoaded);
trace("bytesTotal: " + this.bytesTotal);
trace("");
};
The code is EXACTLY the same, except it isn’t within a function, yet the latter example plays the video correctly, and the first example doesn’t.
This is driving me crazy… any suggestions??
thanks,
Marcus.