listenerObject.complete Help

  • Psychomaze
  • Born
  • Born
  • User avatar
  • Posts: 1

Post 3+ Months Ago

I have an object called my_video and it's on the stage with an instance name of my_video.

Code: [ Select ]
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
  1. import mx.video.*;
  2. var connection_nc:NetConnection = new NetConnection();
  3. connection_nc.connect(null);
  4. var stream_ns:NetStream = new NetStream(connection_nc);
  5. my_video.attachVideo(stream_ns);
  6. stream_ns.setBufferTime(5);
  7. stream_ns.play("001.flv");
  8. var listenerObject:Object = new Object();
  9. // listen for complete event; play new FLV
  10. trace("outside"); //debug message 1
  11. listenerObject.complete = function(eventObject:Object):Void {
  12.     trace("Complete"); //debug message 2 (DOES NOT SHOW UP)
  13.   if (my_video.contentPath == "001.flv") {
  14.     stream_ns.play("004.flv");
  15.   }
  16. };
  17. my_video.addEventListener("complete", listenerObject);
  18. my_video.contentPath == "001.flv";
  19. 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.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23455
  • Loc: Woodbridge VA

Post 3+ Months Ago

This is how you do it. I promise you it works like a charm, albeit it, there is a very small glitch between loading movies (currently I've never found a way around that).

http://www.adobe.com/devnet/flash/artic ... rs_03.html

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 7 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.