4
votes

I imported an FLV file to my FLA flash file, and exported it as an SWF movie.

I want to embed it into my website, and I want it to loop after it ends.

I've already checked the following:

  • files are fully uploaded
  • using the latest version of flash
  • "Publish Preview > Flash" works fine in Adobe Flash CS4
  • "Publish Preview > HTML" also works fine in Adobe Flash CS4

Actionscript solutions I've tried:

To the FLV component:

on (complete){
this.autoRewind=true;
this.play();
}

To the frame where the video was placed:

 var myLis:Object = new Object; 
 myLis.complete = function(){ 
 flvPlayer.play(); 
 } 
 flvPlayer.addEventListener("complete", myLis); 

I've been looking at this for the past week and can't figure it out. I heard that I might check something called "IDE" but I have no idea what that is or how to check that? Any help would do wonders.

Thank you!!

2
Anyone? :/ I've really been stumped on this one. - Jay
What ActionScript version do you use? - amn
@amn Actionscript 2.0, and I believe that code I posted is for 2.0. - Jay

2 Answers

0
votes

Having a looping video on your site is not really a good idea. Most video players allow the user to replay the video manually. If you still want to loop the video, read on

Your earlier code is for ActionScript 2 (the old one). Here's the code for AS3:

 import fl.video.VideoEvent;
 flvPlayer.addEventListener(VideoEvent.COMPLETE, videoFinished);
 function videoFinished(event:VideoEvent){
        flvPlayer.play();
 }; 

You can download Flash Builder from here. That's the IDE (Integrated Development Environment) you heard about.

0
votes

I've figured it out.

Turns out I needed a stop() at the beginning of my actionscript for the frame with the FLV component:

stop();
var listener:Object = new Object();
listener.complete = function():Void {
    flvPlayer.play();
}
flvPlayer.addEventListener("complete", listener);