PDA

View Full Version : media component listener?


Navarone
03-11-2005, 07:25 PM
Ok, I have several key frames in my movie set up to play FLV's using a single media display component with a controller. My key frames are labeled "one", "two", "three", etc.. In my code I have a listener object set up to detect when the flv is done playing. When the first FLV is done playing the listener object displays "media finished" as it should, but the code to jump the play head to the next key frame , where I have the same code, just a different media file doesn't display the media component.

What I want to do is after the media is finished playing, jump to the next frame and play a new media file. Do I need a new listener object for each flv?

in the first frame I have this code:

_root.stop();
_root.myMedia.play(0);
_root.myMedia.autoPlay = true;
_root.myMedia.activePlayControl = true;
_root.myMedia.controllerPolicy = 'on';
_root.myMedia.totalTime = 30;
_root.myMedia.setMedia("videos/riverside_video4.flv", "FLV");
_root.myController.volume = 100;
//////////////////////////////////////
var myListener = new Object();
myListener.complete = function(eventObject) {
trace("media is Finished");
_root.gotoAndPlay("two");
};
myMedia.addEventListener("complete", myListener);

Navarone
03-11-2005, 09:51 PM
FYI - Ok, I may have found a solution. Even though the media component is in seperate frames on the main time line, you can't play the same FLV in succession. In other words, if media component in frame 1 plays "myFLV" the same media component in frame 2 won't play it. So as long as you are playing a different flv each time, it seems to work.