-
listenerObject.complete Help
I have an object called my_video and it's on the stage with an instance name of my_video.
Code:
import mx.video.*;
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.setBufferTime(5);
stream_ns.play("001.flv");
var listenerObject:Object = new Object();
// listen for complete event; play new FLV
trace("outside"); //debug message 1
listenerObject.complete = function(eventObject:Object):Void {
trace("Complete"); //debug message 2 (DOES NOT SHOW UP)
if (my_video.contentPath == "001.flv") {
stream_ns.play("004.flv");
}
};
my_video.addEventListener("complete", listenerObject);
my_video.contentPath == "001.flv";
trace("\noutside 2"); //debug message 3
It plays 001.flv, and I get messages for outside the function but not the "Complete" message to tell it to switch to another video.
Basically, I don't want any buttons or anything for it, I just want it to play one video and when it is complete, move on the other one. I am using Flash 8 Professional, and this is for a progressive download and the flv are already on the remote server but I still cannot get inside the "listenerObject.complete" status to go inside of the function to do more when the clip is finished. It is as if "import mx.video.*;" is not doing anything and it doesn't matter if I leave it there or comment it out.
I've spent all morning searching through so many help sites and livedocs that my head is spinning right now.
-
FK's Geezer Mod
I use this to play multiple flv's using the F8 FLVPlayback component.
Code:
import mx.video.*;
my_FLVPlybk.contentPath = "BonSeries.flv";
var listenerObject:Object = new Object();
// listen for complete event; play new FLV
listenerObject.complete = function(eventObject:Object):Void {
if (my_FLVPlybk.contentPath == "BonSeries.flv") {
my_FLVPlybk.play("BrandonSeries.flv");
} else if (my_FLVPlybk.contentPath == "BrandonSeries.flv") {
my_FLVPlybk.play("BrendaSeries.flv");
} else if (my_FLVPlybk.contentPath == "BrendaSeries.flv") {
my_FLVPlybk.play("ConvoyDownSeries.flv");
} else if (my_FLVPlybk.contentPath == "ConvoyDownSeries.flv") {
my_FLVPlybk.play("BonSeries.flv");
}
};
my_FLVPlybk.addEventListener("complete", listenerObject);
-
Nope, it's not working and I made a new object called my_FLVPlybk and it's on the stage with an instance name of my_FLVPlybk. (width 450, height 120)
Code:
import mx.video.*;
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_FLVPlybk.attachVideo(stream_ns);
stream_ns.setBufferTime(5);
my_FLVPlybk.contentPath = "http://silverlions.psychomaze.net/banner/001.flv";
stream_ns.play(my_FLVPlybk.contentPath);
var listenerObject:Object = new Object();
// listen for complete event; play new FLV
listenerObject.complete = function(eventObject:Object):Void {
if (my_FLVPlybk.contentPath == "http://silverlions.psychomaze.net/banner/001.flv") {
my_FLVPlybk.play("http://silverlions.psychomaze.net/banner/002.flv");
} else if (my_FLVPlybk.contentPath == "http://silverlions.psychomaze.net/banner/002.flv") {
my_FLVPlybk.play("http://silverlions.psychomaze.net/banner/003.flv");
} else if (my_FLVPlybk.contentPath == "http://silverlions.psychomaze.net/banner/003.flv") {
my_FLVPlybk.play("http://silverlions.psychomaze.net/banner/004.flv");
} else if (my_FLVPlybk.contentPath == "http://silverlions.psychomaze.net/banner/004.flv") {
my_FLVPlybk.play("http://silverlions.psychomaze.net/banner/001.flv");
}
};
my_FLVPlybk.addEventListener("complete", listenerObject);
I added infomation about how to make a connection but it is still not activating the "listenerObject.complete" line.
I don't understand why it is acting this way? Am I copying and pasting it wrong or something? (sheesh)
The ULTIMATE Procrastinator, at yer service ^^;
-
FK's Geezer Mod
Is this the same domain the movie is on?
silverlions.psychomaze.net
-
yes.... It's meant to be a banner with random video clips running
The ULTIMATE Procrastinator, at yer service ^^;
-
FK's Geezer Mod
Are you using the FLV Playback component in F8?
-
What I did was go to libary, click on the menu and clicked on New Video.
The line in the first post "stream_ns.play(my_FLVPlybk.contentPath);"
At leasts plays the first video. I don't understand why the objectListener is not working.
The ULTIMATE Procrastinator, at yer service ^^;
-
FK's Geezer Mod
OK, your using a video object. The code I posted is for the FLVPlayback component in Flash 8. It won't work on a video object.
-
Hmm.... that explains alot so how to I get a FLVPlayback component set up?
[EDIT] I figured it out.... also... I discovered that if I make the contentPath in the SWF instance to "" and to autoRewind to false.... it actually works wonders! Thank you so much!
I'll be sure to post the finished product ^^;
Last edited by Psychomaze; 06-20-2006 at 01:44 PM.
The ULTIMATE Procrastinator, at yer service ^^;
-
FK's Geezer Mod
You still haven't said if your using Flash 8 or not. If so, just open the component panel, find the flv playback component and double click it, that puts one on stage. Position it, fill in the width and height boxes in properties and give it an instance name. Then use that code I gave, in a frame.
I use to play with the video object, but this component is so easy to use I quit using everything else. The video quality is so much better than anything else, I probably won't use anything else now.
-
Heh.... I just edited my last post... Thanks to you, I got it figured it out. Thank you so much!
The ULTIMATE Procrastinator, at yer service ^^;
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
|