Looping Multiple FLV files in Flash CS3
by Jim Zons
on
Jul 8, 2008 at 2:12:27 am
Okay ... here's maybe an easy one for someone who knows what they are doing! I am not well-versed in Action Script 3 ... I'm just a hacker. I have created a Flash project where I have three instances of a very small FLV movie that I want to loop endlessly when launched in a user's browser. Using this bit of Action Script:
import fl.video.*;
// Video component instance name
var flvControl = flames1;
var flvSource = "flames.flv";
// Loop the video when it completes
function completeHandler(event:VideoEvent):void
{
flvControl.seek(0);
flvControl.play()
}
flvControl.addEventListener(VideoEvent.COMPLETE, completeHandler);
// Set video
flvControl.source = flvSource;
I can make one instance of the video repeat, but not the other two. Right now, I have the three instances of the video on a single layer, but even if I move it to other layers so that they are all on separate layers, I then get Action Script errors and none of the videos loop. I even tried having it call up three SEPARATE videos (which seems unnecessarily wasteful when it is the exact same video) I get more Action Script errors:
1151: A conflict exists with definition flvControl in namespace internal
1021: Duplicate function definition
Any ideas how I can get all three videos to loop? Here is a link to what I am actually trying to accomplish:
Note that the middle fireplace flames loop, but the one on the left and the one on the right do not .... I would like these to loop like the center fireplace. Any and all suggestions are welcome!
Re: Looping Multiple FLV files in Flash CS3 by Pieter Helsen on Jul 8, 2008 at 7:30:49 am
What does this do for you?
import fl.video.*;
// Video component instance name
// You need to change the instance name of your video components
// It uses the same source for each instance
var flvControl1 = flames1;
var flvControl2 = flames2;
var flvControl3 = flames3;
var flvSource = "flames.flv";
// Loop the video when it completes
function completeHandler(event:VideoEvent):void
{
flvControl.seek(0);
flvControl.play()
}
Re: Looping Multiple FLV files in Flash CS3 by Jim Zons on Jul 8, 2008 at 11:44:17 am
Pieter ... wow ... really close. I was still getting an error for an undefined element, so I looked closely at the scripting, and hacked this solution:
import fl.video.*;
// Video component instance name
// You need to change the instance name of your video components
// It uses the same source for each instance
var flvControl1 = flames1;
var flvControl2 = flames2;
var flvControl3 = flames3;
var flvSource = "flames.flv";
// Loop the video when it completes
function completeHandler(event:VideoEvent):void
{
flvControl1.seek(0);