Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE FLASH: Adobe Flash ForumAdobe Flash TutorialsAdobe Flash Video TutorialsWeb Streaming ForumAdobe Flash

Looping Multiple FLV files in Flash CS3

Cow Forums : Adobe Flash
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:

http://7stream.net/fireside/home.html

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!

Respond to this post     Return to posts index

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()
}

flvControl1.addEventListener(VideoEvent.COMPLETE, completeHandler);
flvControl2.addEventListener(VideoEvent.COMPLETE, completeHandler);
flvControl3.addEventListener(VideoEvent.COMPLETE, completeHandler);

// Set video
flvControl1.source = flvSource;
flvControl2.source = flvSource;
flvControl3.source = flvSource;


Kind regards,
Pieter

Respond to this post     Return to posts index

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);

flvControl1.play()

flvControl2.seek(0);

flvControl2.play()

flvControl3.seek(0);

flvControl3.play()
}

flvControl1.addEventListener(VideoEvent.COMPLETE, completeHandler);
flvControl2.addEventListener(VideoEvent.COMPLETE, completeHandler);
flvControl3.addEventListener(VideoEvent.COMPLETE, completeHandler);

// Set video
flvControl1.source = flvSource;
flvControl2.source = flvSource;
flvControl3.source = flvSource;


I needed to create three separate flvControl.seek/play commands and that did the trick! I've posted the fixed animation to the same location:

http://7stream.net/fireside/home.html

Thanks again!



Respond to this post     Return to posts index


Re: Looping Multiple FLV files in Flash CS3
by Pieter Helsen on Jul 8, 2008 at 12:35:48 pm

This should work as well and would be easier still :)

// Loop the video when it completes
function completeHandler(event:VideoEvent):void
{
this.seek(0);
this.play()
}

In any case, glad you managed to get it fixed.

Kind regards,
Pieter

Respond to this post     Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINEDVDsBOOKSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]