-
Looping FLV (event:NetStatusEvent) trigger??
Any ideas why my function "replicaLoop" doesn't run??
I'm sure the function will work but it's not running
:-(
var replicaConnection:NetConnection = new NetConnection();
replicaConnection.connect(null);
var replicaStream:NetStream = new NetStream(replicaConnection);
replicaStream.play("replica.flv");
var replicaListener:Object = new Object();
//replicaListener.onMetaData = onMetaData;
replicaStream.client = replicaListener;
var replicaVideo:Video = new Video();
replicaVideo.attachNetStream(replicaStream);
addChild(replicaVideo);
function replicaPosition():void
{
replicaVideo.y = 17;
replicaVideo.x = 20;
replicaVideo.width = 510;
replicaVideo.height = 286;
}
replicaPosition();
function replicaLoop( event:NetStatusEvent ) :void
{
trace("working??");
if(event.info.code == "NetStream.Play.Stop")
replicaStream.seek(0);
}
-
Total Universe Mod
If the stream is stopped, you cannot seek. Use replicaStream.play(0)
-
That's not really the point...
I've seen a few posts where people claim this code has worked fine for them but my function isn't running.
function replicaLoop( event:NetStatusEvent ) :void
{
trace("working??");
if(event.info.code == "NetStream.Play.Stop")
replicaStream.seek(0);
}
This isn't tracing so it's not running the function. I was led to believe it would be triggered by the incoming netStream but that's not the case.
-
Total Universe Mod
You need to add and event listener to your NetConnection object and point to replicaLoop as your handler.
Code:
var replicaConnection:NetConnection = new NetConnection();
replicaConnection.connect(null);
replicaConnection.addEventListener(NetStatusEvent.NET_STATUS, replicaLoop);
var replicaStream:NetStream = new NetStream(replicaConnection);
http://livedocs.adobe.com/flash/9.0/...xamplesSummary
Last edited by jAQUAN; 11-06-2009 at 11:20 AM.
-
Here's a version that seems to work well for me. It traces when video is complete, then seeks back to where ever you want and will pause or play from there:
Code:
ns.onStatus = function(info) {
if(info.code == "NetStream.Play.Stop") {
trace("Video complete")
ns.seek(5);
ns.pause();
}
}
Best wishes,
Eye for Video
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|