View Full Version : loop flv in mediaDisplay component
madanvil
04-23-2005, 11:28 AM
i searched this forum and found a post on how to loop an .flv in the mediaDisplay component and it gave a code that goes like this...
med.setMedia(media_url, "FLV");
var listener = new Object();
listener.complete = function(objetEvt) {
trace(med.contentPath + "complete");
med.play(0);
};
med.addEventListener("complete", listener);
however, i don't understand how it works....i was unable to place that code on the instance of the mediaDisplay compontent itself, and putting on the keyframe didn't help either..i just call up the flv using the component inspector and it plays the file, but only once..this one is really riding my boobies...any help would be be great..THX
fx2ooo
06-15-2005, 04:44 PM
Don't know if you're still interested, but I needed to do the same thing and just figured it out. You had it almost right, but it was hard to read so you probably just missed the instance name (and you need to quote the url). Put the script on a keyframe, and delete the url from the component inspector.
myMediaComponentInstanceName.setMedia("myFlvUrl.flv", "FLV");
var listener = new Object();
listener.complete = function(objetEvt) {
trace(myMediaComponentInstanceName.contentPath + "complete");
myMediaComponentInstanceName.play(0);
};
myMediaComponentInstanceName.addEventListener("complete", listener);
willythekid
06-15-2005, 05:11 PM
Thanks for sharing. I'm trying to make a variation of your code to make the flash jump back to frame 1 once the flv. is finished. I seem to do something wrong though, get the message "undefined complete" when I play the swf, and the flash does Not go back to frame 1. Can anyone help?
stop();
myMediaComponentInstanceName.setMedia("myFlvUrl.flv", "FLV");
var listener = new Object();
listener.complete = function(objetEvt) {
myMediaComponentInstanceName.contentPath + "complete");
this.play(1);
};
myMediaComponentInstanceName.addEventListener("complete", listener);
Thanks,
willythekid
fx2ooo
06-15-2005, 05:16 PM
Try switching this to _root (or the instance name of the timeline you are reffering to), and using gotoAndPlay(1).
Did you accidentally chop off your 'trace(...'? That could be why it's undefined.
willythekid
06-15-2005, 05:35 PM
Now it almost works, Flash jumps back to frame 1. But, still i get the message "undefined complete", although i made sure the "trace" was not chopped off. My mediadisplay component is called "LaserClip" and the flv is called "LasercutBeauty.flv". Maybe i'm doing som formatting error?
stop();
this.LaserClip.setMedia("LasercutBeauty.flv", "FLV");
var listener = new Object();
listener.complete = function(objetEvt) {
trace(this.LaserClip.contentPath + "complete");
_root.gotoAndPlay(1);
};
this.LaserClip.addEventListener("complete", listener);
best regards-
willythekid
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.